{
  "openapi": "3.1.1",
  "info": {
    "title": "Eternify Ledger API",
    "version": "v1",
    "x-wire-version": "2026-08-31",
    "description": "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": "purchases",
      "description": "Vendors, bills, purchase orders, payment runs and vendor credits.",
      "x-display-name": "Purchases"
    },
    {
      "name": "sales",
      "description": "Customers, invoices, receipts and receivables.",
      "x-display-name": "Sales"
    },
    {
      "name": "accounting",
      "description": "The chart of accounts, entities, journal entries, dimensions and payment terms.",
      "x-display-name": "Accounting"
    },
    {
      "name": "banking-and-payments",
      "description": "Bank connections, statements, reconciliation and payments.",
      "x-display-name": "Banking and payments"
    },
    {
      "name": "tax",
      "description": "Tax codes, registrations, returns and filings.",
      "x-display-name": "Tax"
    },
    {
      "name": "reports",
      "description": "Financial reports and their exports.",
      "x-display-name": "Reports"
    },
    {
      "name": "close",
      "description": "Period close, year-end and the checklists around them.",
      "x-display-name": "Close"
    },
    {
      "name": "settings",
      "description": "Workspace and ledger settings.",
      "x-display-name": "Settings"
    },
    {
      "name": "people",
      "description": "Team members, seats and invitations.",
      "x-display-name": "People"
    },
    {
      "name": "documents",
      "description": "Files, attachments and document intake.",
      "x-display-name": "Documents"
    },
    {
      "name": "platform",
      "description": "Events and the other operations that serve integrations.",
      "x-display-name": "Platform"
    }
  ],
  "paths": {
    "/v1/access-log": {
      "get": {
        "operationId": "accessLog",
        "summary": "Lists who opened which records on the ledger, newest first.",
        "description": "Lists who opened which records on the ledger, newest first. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "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}$"
            }
          },
          {
            "name": "actor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "event",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Event"
            }
          },
          {
            "name": "resourceKind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9-]{0,39}$"
            }
          },
          {
            "name": "resource",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "gate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hide",
                "only"
              ]
            }
          },
          {
            "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"
                          },
                          "at": {
                            "type": "string",
                            "minLength": 20
                          },
                          "event": {
                            "$ref": "#/components/schemas/Event"
                          },
                          "actor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "resource": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "resourceKind": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "resourceId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "ipAddress": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "door": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "web",
                                  "rest",
                                  "mcp"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "operation": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "appName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "at",
                          "event",
                          "actor",
                          "resource",
                          "resourceKind",
                          "resourceId",
                          "ipAddress",
                          "door",
                          "operation",
                          "appName"
                        ],
                        "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/accounts": {
      "get": {
        "operationId": "listAccounts",
        "summary": "Lists the accounts of the chart in order, with the server's total.",
        "description": "Lists the accounts of the chart in order, with the server's total. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "activeForEntityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "inactiveForEntityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "excludeSubtreeOf",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "maxDepth",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 4
            }
          }
        ],
        "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"
                          },
                          "code": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "ASSET",
                              "LIABILITY",
                              "EQUITY",
                              "REVENUE",
                              "EXPENSE"
                            ]
                          },
                          "gifiCode": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "aspeLine": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "cashFlowRole": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "CASH",
                                  "OPERATING",
                                  "INVESTING",
                                  "FINANCING",
                                  "NON_CASH"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "reconciliation": {
                            "type": "string",
                            "enum": [
                              "NONE",
                              "CLEARS_TO_ZERO",
                              "CERTIFIED"
                            ]
                          },
                          "parentId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "balanceMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "code",
                          "name",
                          "type",
                          "gifiCode",
                          "aspeLine",
                          "cashFlowRole",
                          "reconciliation",
                          "parentId",
                          "balanceMinor",
                          "currency"
                        ],
                        "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": "createAccount",
        "summary": "Creates an account in the chart of accounts.",
        "description": "Creates an account in the chart of accounts. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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
                  },
                  "code": {
                    "type": "string",
                    "pattern": "^[0-9A-Za-z.-]{1,20}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "ASSET",
                      "LIABILITY",
                      "EQUITY",
                      "REVENUE",
                      "EXPENSE"
                    ]
                  },
                  "gifiCode": {
                    "type": "string"
                  },
                  "aspeLine": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "cashFlowRole": {
                    "type": "string",
                    "enum": [
                      "CASH",
                      "OPERATING",
                      "INVESTING",
                      "FINANCING",
                      "NON_CASH"
                    ]
                  },
                  "parentId": {
                    "type": "string"
                  }
                },
                "required": [
                  "entityId",
                  "code",
                  "name",
                  "type"
                ],
                "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": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/accounts/activation": {
      "post": {
        "operationId": "setActivation",
        "summary": "Switches one account on or off for one company.",
        "description": "Switches one account on or off for one company. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "accountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "active": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "accountId",
                  "entityId",
                  "active"
                ],
                "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": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/accounts/certifications/{certificationId}/withdraw": {
      "post": {
        "operationId": "withdrawAccountCertification",
        "summary": "Withdraws the certification of an account's balance.",
        "description": "Withdraws the certification of an account's balance. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "certificationId",
            "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/ListAccountCertificationsResponseItem"
                }
              }
            }
          },
          "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/accounts/dimension-policy": {
      "post": {
        "operationId": "setDimensionPolicy",
        "summary": "Sets which dimensions an account must carry on its postings.",
        "description": "Sets which dimensions an account must carry on its postings. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "accountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "dimensionTypeId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "policy": {
                    "type": "string",
                    "enum": [
                      "REQUIRED",
                      "OPTIONAL",
                      "FORBIDDEN"
                    ]
                  }
                },
                "required": [
                  "accountId",
                  "dimensionTypeId",
                  "policy"
                ],
                "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": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/accounts/{accountId}": {
      "get": {
        "operationId": "getAccount",
        "summary": "Returns one account with its balance, its activation and its posting policy.",
        "description": "Returns one account with its balance, its activation and its posting policy. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entity",
            "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": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "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": {
                    "id": {
                      "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"
                      ]
                    },
                    "cashFlowRole": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "CASH",
                            "OPERATING",
                            "INVESTING",
                            "FINANCING",
                            "NON_CASH"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "reconciliation": {
                      "type": "string",
                      "enum": [
                        "NONE",
                        "CLEARS_TO_ZERO",
                        "CERTIFIED"
                      ]
                    },
                    "parentId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "balanceMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "ledgerId": {
                      "type": "string"
                    },
                    "dimensionPolicies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "dimensionTypeId": {
                            "type": "string"
                          },
                          "dimensionTypeCode": {
                            "type": "string"
                          },
                          "dimensionTypeLabel": {
                            "type": "string"
                          },
                          "policy": {
                            "type": "string",
                            "enum": [
                              "REQUIRED",
                              "OPTIONAL",
                              "FORBIDDEN"
                            ]
                          }
                        },
                        "required": [
                          "dimensionTypeId",
                          "dimensionTypeCode",
                          "dimensionTypeLabel",
                          "policy"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "activations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "active": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "entityId",
                          "entityName",
                          "active"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "activity": {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "lineId": {
                                "type": "string"
                              },
                              "entryId": {
                                "type": "string"
                              },
                              "entryRef": {
                                "type": "string"
                              },
                              "entryDate": {
                                "type": "string"
                              },
                              "entityName": {
                                "type": "string"
                              },
                              "memo": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "debitMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "creditMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "balanceMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "functionalDebitMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "functionalCreditMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "functionalCurrency": {
                                "type": "string"
                              },
                              "document": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "INVOICE",
                                          "CREDIT_NOTE",
                                          "RECEIPT"
                                        ]
                                      },
                                      "id": {
                                        "type": "string"
                                      },
                                      "number": {
                                        "type": "string"
                                      },
                                      "href": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "id",
                                      "number",
                                      "href"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "lineId",
                              "entryId",
                              "entryRef",
                              "entryDate",
                              "entityName",
                              "memo",
                              "debitMinor",
                              "creditMinor",
                              "balanceMinor",
                              "currency",
                              "functionalDebitMinor",
                              "functionalCreditMinor",
                              "functionalCurrency"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "data",
                        "nextCursor",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "openingBalanceMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "appliedScope": {
                      "type": "object",
                      "properties": {
                        "entityId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "entityName": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "asOf": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "entityId",
                        "entityName",
                        "asOf"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "code",
                    "name",
                    "type",
                    "gifiCode",
                    "aspeLine",
                    "cashFlowRole",
                    "reconciliation",
                    "parentId",
                    "balanceMinor",
                    "currency",
                    "ledgerId",
                    "dimensionPolicies",
                    "activations",
                    "activity",
                    "openingBalanceMinor",
                    "appliedScope"
                  ],
                  "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": "updateAccount",
        "summary": "Changes an account's name, number or settings.",
        "description": "Changes an account's name, number or settings. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reconciliation": {
                    "type": "string",
                    "enum": [
                      "NONE",
                      "CLEARS_TO_ZERO",
                      "CERTIFIED"
                    ]
                  },
                  "code": {
                    "type": "string",
                    "pattern": "^[0-9A-Za-z.-]{1,20}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "gifiCode": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "aspeLine": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cashFlowRole": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "CASH",
                          "OPERATING",
                          "INVESTING",
                          "FINANCING",
                          "NON_CASH"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "parentId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "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": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "changed": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "ok",
                    "changed"
                  ],
                  "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/accounts/{accountId}/audit": {
      "get": {
        "operationId": "listAccountAudit",
        "summary": "Lists the audit trail of one account.",
        "description": "Lists the audit trail of one account. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "action",
            "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/accounts/{accountId}/certification-support": {
      "get": {
        "operationId": "accountCertificationSupport",
        "summary": "Returns the support a balance certification is given on.",
        "description": "Returns the support a balance certification is given on. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "year",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 2000,
              "maximum": 2100
            }
          },
          {
            "name": "month",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          }
        ],
        "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": {
                    "accountId": {
                      "type": "string"
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "periodYear": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "periodMonth": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "periodEnd": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "source": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "PAYABLES_AGEING"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "ledgerBalanceMinor": {
                      "type": "string"
                    },
                    "supportComputedMinor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "differenceMinor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "unavailable": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "detail": {
                              "type": "string"
                            },
                            "remedy": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "detail",
                            "remedy"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "accountId",
                    "entityId",
                    "entityName",
                    "periodYear",
                    "periodMonth",
                    "periodEnd",
                    "source",
                    "ledgerBalanceMinor",
                    "supportComputedMinor",
                    "differenceMinor",
                    "unavailable",
                    "entityTimeZone"
                  ],
                  "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/accounts/{accountId}/certifications": {
      "get": {
        "operationId": "listAccountCertifications",
        "summary": "Lists the certifications of an account's balance.",
        "description": "Lists the certifications of an account's balance. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "includeWithdrawn",
            "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/ListAccountCertificationsResponseItem"
                      }
                    },
                    "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": "certifyAccount",
        "summary": "Certifies an account's balance as correct at a date.",
        "description": "Certifies an account's balance as correct at a date. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "periodYear": {
                    "type": "integer",
                    "minimum": 2000,
                    "maximum": 2100
                  },
                  "periodMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "supportSource": {
                    "default": "TYPED",
                    "type": "string",
                    "enum": [
                      "TYPED",
                      "SUBLEDGER"
                    ]
                  },
                  "supportBalanceMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "evidenceDocumentId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "entityId",
                  "periodYear",
                  "periodMonth"
                ],
                "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/ListAccountCertificationsResponseItem"
                }
              }
            }
          },
          "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/ai-use/ceiling": {
      "put": {
        "operationId": "setAiSpendCeiling",
        "summary": "Sets the most Eternify Assistant may spend on the ledger.",
        "description": "Sets the most Eternify Assistant may spend on the ledger. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ceilingMicroCad": {
                    "type": "string",
                    "pattern": "^\\d{1,18}$"
                  }
                },
                "required": [
                  "ceilingMicroCad"
                ],
                "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/GetAiUseSummaryResponse"
                }
              }
            }
          },
          "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/ai-use/faults": {
      "get": {
        "operationId": "listAiProviderFaults",
        "summary": "Lists the faults the AI provider returned, newest first.",
        "description": "Lists the faults the AI provider returned, newest first. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PASSED_OVER",
                "NO_MEMBER_LEFT"
              ]
            }
          },
          {
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListAiProviderFaultsResponseItem"
                      }
                    },
                    "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/ai-use/feature-budgets/{featureGroup}": {
      "put": {
        "operationId": "setAiFeatureBudget",
        "summary": "Sets the budget for one feature of Eternify Assistant.",
        "description": "Sets the budget for one feature of Eternify Assistant. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "featureGroup",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ceilingMicroCad": {
                    "type": "string",
                    "pattern": "^\\d{1,18}$"
                  }
                },
                "required": [
                  "ceilingMicroCad"
                ],
                "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/GetAiUseSummaryResponse"
                }
              }
            }
          },
          "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/ai-use/feature-budgets/{featureGroup}/clear": {
      "post": {
        "operationId": "clearAiFeatureBudget",
        "summary": "Clears the budget for one feature of Eternify Assistant.",
        "description": "Clears the budget for one feature of Eternify Assistant. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "featureGroup",
            "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/GetAiUseSummaryResponse"
                }
              }
            }
          },
          "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/ai-use/report": {
      "get": {
        "operationId": "getAiUseReport",
        "summary": "Returns the report of Eternify Assistant use for a period.",
        "description": "Returns the report of Eternify Assistant use for a period. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "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}$"
            }
          },
          {
            "name": "feature",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          },
          {
            "name": "providerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            }
          },
          {
            "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": {
                          "month": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}$"
                          },
                          "feature": {
                            "type": "string"
                          },
                          "featureGroup": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "DOCUMENT_READING",
                                  "CODING_AND_MATCHING",
                                  "DRAFTING",
                                  "CHAT",
                                  "EVALUATION"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "providerId": {
                            "type": "string"
                          },
                          "model": {
                            "type": "string"
                          },
                          "modelLocation": {
                            "type": "string"
                          },
                          "calls": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "failedCalls": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "retriedCalls": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "answers": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "providerCalls": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "providerCallsUnknown": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "inputTokens": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "outputTokens": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "costMicroCad": {
                            "type": "string",
                            "pattern": "^\\d{1,18}$"
                          },
                          "withheld": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string"
                                },
                                "count": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "kind",
                                "count"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "overLatencyCalls": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "month",
                          "feature",
                          "featureGroup",
                          "providerId",
                          "model",
                          "modelLocation",
                          "calls",
                          "failedCalls",
                          "retriedCalls",
                          "answers",
                          "providerCalls",
                          "providerCallsUnknown",
                          "inputTokens",
                          "outputTokens",
                          "costMicroCad",
                          "withheld",
                          "overLatencyCalls"
                        ],
                        "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/ai-use/summary": {
      "get": {
        "operationId": "getAiUseSummary",
        "summary": "Returns how much Eternify Assistant was used and what it cost.",
        "description": "Returns how much Eternify Assistant was used and what it cost. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "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/GetAiUseSummaryResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/analysis/measures": {
      "get": {
        "operationId": "listMeasures",
        "summary": "Lists the measures and dimensions these books answer, custom dimensions and fields included.",
        "description": "Lists the measures and dimensions these books answer, custom dimensions and fields included. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements: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": {
                    "measures": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "money",
                              "count",
                              "number"
                            ]
                          },
                          "view": {
                            "type": "string"
                          },
                          "timeDimension": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "pointInTime": {
                            "type": "boolean"
                          },
                          "dimensions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "generated": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "name",
                          "label",
                          "description",
                          "type",
                          "view",
                          "timeDimension",
                          "pointInTime",
                          "dimensions",
                          "generated"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "dimensions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "measures",
                    "dimensions"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/analysis/measures/query": {
      "post": {
        "operationId": "queryLedger",
        "summary": "Answers a question about the books from named measures and dimensions, with the SQL it ran.",
        "description": "Answers a question about the books from named measures and dimensions, with the SQL it ran. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "statements:read",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "measures": {
                    "minItems": 1,
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "groupBy": {
                    "default": [],
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "filters": {
                    "$ref": "#/components/schemas/Filters"
                  },
                  "period": {
                    "$ref": "#/components/schemas/Period2"
                  },
                  "orderBy": {
                    "$ref": "#/components/schemas/OrderBy"
                  },
                  "limit": {
                    "default": 100,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  },
                  "cursor": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "measures"
                ],
                "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": {
                  "$ref": "#/components/schemas/QueryLedgerResponse"
                }
              }
            }
          },
          "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/analysis/runs": {
      "get": {
        "operationId": "listQueryRuns",
        "summary": "Lists the analysis queries run on these books: who asked, through which door and app, what was read.",
        "description": "Lists the analysis queries run on these books: who asked, through which door and app, what was read. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "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
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "MEASURES",
                "SQL"
              ]
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ANSWERED",
                "ANSWERED_WITHOUT_TOTAL"
              ]
            }
          }
        ],
        "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"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "MEASURES",
                              "SQL"
                            ]
                          },
                          "personName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "presence": {
                            "type": "string",
                            "enum": [
                              "person",
                              "connected_session",
                              "background_agent"
                            ]
                          },
                          "door": {
                            "type": "string",
                            "enum": [
                              "web",
                              "rest",
                              "mcp"
                            ]
                          },
                          "appName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "views": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "rowCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "total": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "durationMs": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "outcome": {
                            "type": "string",
                            "enum": [
                              "ANSWERED",
                              "ANSWERED_WITHOUT_TOTAL"
                            ]
                          },
                          "text": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "personName",
                          "presence",
                          "door",
                          "appName",
                          "views",
                          "rowCount",
                          "total",
                          "durationMs",
                          "outcome",
                          "text",
                          "createdAt"
                        ],
                        "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/analysis/saved": {
      "get": {
        "operationId": "listSavedQueries",
        "summary": "Lists the saved analysis queries of these books, the caller's own and the shared ones.",
        "description": "Lists the saved analysis queries of these books, the caller's own and the shared ones. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements: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
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "MEASURES",
                "SQL"
              ]
            }
          },
          {
            "name": "archived",
            "in": "query",
            "required": false,
            "schema": {
              "default": "no",
              "type": "string",
              "enum": [
                "no",
                "only",
                "all"
              ]
            }
          },
          {
            "name": "owner",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "mine",
                "shared"
              ]
            }
          }
        ],
        "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/ListSavedQueriesResponseItem"
                      }
                    },
                    "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": "createSavedQuery",
        "summary": "Saves an analysis query under a name, private or shared with these books.",
        "description": "Saves an analysis query under a name, private or shared with these books. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "MEASURES",
                      "SQL"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "definition": {
                    "$ref": "#/components/schemas/Definition"
                  },
                  "shared": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "kind",
                  "name",
                  "definition"
                ],
                "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/ListSavedQueriesResponseItem"
                }
              }
            }
          },
          "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/analysis/saved/{savedQueryId}": {
      "get": {
        "operationId": "getSavedQuery",
        "summary": "Returns one saved analysis query with its definition.",
        "description": "Returns one saved analysis query with its definition. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "savedQueryId",
            "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/ListSavedQueriesResponseItem"
                }
              }
            }
          },
          "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": "updateSavedQuery",
        "summary": "Changes the name, description, definition or sharing of a saved analysis query.",
        "description": "Changes the name, description, definition or sharing of a saved analysis query. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "savedQueryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ifRevision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "definition": {
                    "$ref": "#/components/schemas/Definition"
                  },
                  "shared": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "ifRevision"
                ],
                "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/ListSavedQueriesResponseItem"
                }
              }
            }
          },
          "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/analysis/saved/{savedQueryId}/archive": {
      "post": {
        "operationId": "archiveSavedQuery",
        "summary": "Archives a saved analysis query so it leaves the lists; it can be restored.",
        "description": "Archives a saved analysis query so it leaves the lists; it can be restored. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "savedQueryId",
            "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/ListSavedQueriesResponseItem"
                }
              }
            }
          },
          "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/analysis/saved/{savedQueryId}/restore": {
      "post": {
        "operationId": "restoreSavedQuery",
        "summary": "Restores an archived saved analysis query to the lists.",
        "description": "Restores an archived saved analysis query to the lists. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "savedQueryId",
            "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/ListSavedQueriesResponseItem"
                }
              }
            }
          },
          "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/analysis/sql/check": {
      "post": {
        "operationId": "checkLedgerSql",
        "summary": "Checks one SELECT against the prepared views and returns the views it reads and the text that would run.",
        "description": "Checks one SELECT against the prepared views and returns the views it reads and the text that would run. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "statements:read",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sql": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 20000
                  }
                },
                "required": [
                  "sql"
                ],
                "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": {
                    "views": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "sql": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "views",
                    "sql"
                  ],
                  "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/analysis/sql/query": {
      "post": {
        "operationId": "queryLedgerSql",
        "summary": "Runs one read-only SELECT over the prepared views of these books and returns a page of rows.",
        "description": "Runs one read-only SELECT over the prepared views of these books and returns a page of rows. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "statements:read",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sql": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 20000
                  },
                  "limit": {
                    "default": 100,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  },
                  "cursor": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "sql"
                ],
                "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": {
                  "$ref": "#/components/schemas/QueryLedgerResponse"
                }
              }
            }
          },
          "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/analysis/views": {
      "get": {
        "operationId": "listAnalysisViews",
        "summary": "Lists the views, columns and functions a SQL query may use in these books.",
        "description": "Lists the views, columns and functions a SQL query may use in these books. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements: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": {
                    "views": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "capability": {
                            "type": "string"
                          },
                          "columns": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "id",
                                    "text",
                                    "date",
                                    "instant",
                                    "number",
                                    "count",
                                    "money",
                                    "boolean",
                                    "json"
                                  ]
                                },
                                "description": {
                                  "type": "string"
                                },
                                "references": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "name",
                                "type",
                                "description",
                                "references"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "name",
                          "label",
                          "description",
                          "capability",
                          "columns"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "functions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "statementTimeoutMs": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "lockTimeoutMs": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "pageDefault": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "pageMax": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "offsetMax": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "sqlChars": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "parseDepth": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "relations": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "ctes": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "concurrentPerLedger": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "concurrentPerDatabase": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "measures": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "groupBy": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "filters": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "filterValues": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "orderBy": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "statementTimeoutMs",
                        "lockTimeoutMs",
                        "pageDefault",
                        "pageMax",
                        "offsetMax",
                        "sqlChars",
                        "parseDepth",
                        "relations",
                        "ctes",
                        "concurrentPerLedger",
                        "concurrentPerDatabase",
                        "measures",
                        "groupBy",
                        "filters",
                        "filterValues",
                        "orderBy"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "views",
                    "functions",
                    "limits"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/anomaly-desk": {
      "get": {
        "operationId": "listAnomalyDesk",
        "summary": "Lists the anomalies the ledger found, waiting for a person to resolve them.",
        "description": "Lists the anomalies the ledger found, waiting for a person to resolve them. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "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"
                          },
                          "entityId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entityName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "NOT_A_BILL",
                              "CODING_UNUSABLE",
                              "CODING_INCOMPLETE",
                              "DUPLICATE_HARD_STOP",
                              "MODEL_REFUSED",
                              "MODEL_OUTPUT_UNPARSABLE",
                              "BUDGET_EXCEEDED",
                              "PROPOSAL_INPUT_TOO_LARGE",
                              "PROMPT_INVALID",
                              "UNREADABLE_DOCUMENT",
                              "CREDIT_TO_FINISH",
                              "OTHER"
                            ]
                          },
                          "reason": {
                            "type": "string"
                          },
                          "detail": {
                            "type": "string"
                          },
                          "document": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "fileName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "fileName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "supplierName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "vendor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "invoiceNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "draftBill": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "DRAFT",
                                      "IN_REVIEW",
                                      "DECLINED",
                                      "APPROVED",
                                      "HELD",
                                      "OPEN",
                                      "DUE",
                                      "OVERDUE",
                                      "IN_RUN",
                                      "PARTIALLY_PAID",
                                      "PAID",
                                      "VOID"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "status"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "duplicateOfBillId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "raisedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "raisedFor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "readAgain": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "offered": {
                                    "type": "boolean"
                                  },
                                  "attempt": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "max": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "why": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "offered",
                                  "attempt",
                                  "max",
                                  "why"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "correction": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "replaces": {
                                    "$ref": "#/components/schemas/BillOption1"
                                  },
                                  "differences": {
                                    "$ref": "#/components/schemas/Differences"
                                  },
                                  "printed": {
                                    "type": "object",
                                    "properties": {
                                      "says": {
                                        "type": "string",
                                        "enum": [
                                          "CORRECTS_AN_INVOICE",
                                          "NEW_INVOICE",
                                          "NOT_STATED"
                                        ]
                                      },
                                      "quote": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "maxLength": 160
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "readBy": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "enum": [
                                              "RULE",
                                              "MODEL"
                                            ]
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "notReadReason": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "enum": [
                                              "DISCLOSURE",
                                              "BUDGET",
                                              "PROVIDER",
                                              "REFUSED",
                                              "TRUNCATED",
                                              "UNPARSABLE",
                                              "QUOTE_NOT_IN_TEXT",
                                              "INSTRUCTION_IN_QUOTE",
                                              "RUN_TIME",
                                              "NOTHING_FOUND"
                                            ]
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "promptVersion": {
                                        "type": [
                                          "string",
                                          "null"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "says",
                                      "quote",
                                      "readBy",
                                      "notReadReason",
                                      "promptVersion"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "earlierDecline": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "byName": {
                                            "type": "string"
                                          },
                                          "on": {
                                            "type": "string",
                                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                          },
                                          "reason": {
                                            "type": "string",
                                            "maxLength": 1000
                                          }
                                        },
                                        "required": [
                                          "byName",
                                          "on",
                                          "reason"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "offered": {
                                    "type": "boolean"
                                  },
                                  "why": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "replaces",
                                  "differences",
                                  "printed",
                                  "earlierDecline",
                                  "offered",
                                  "why"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "proposalId",
                          "entityId",
                          "entityName",
                          "kind",
                          "reason",
                          "detail",
                          "document",
                          "supplierName",
                          "vendor",
                          "invoiceNumber",
                          "draftBill",
                          "duplicateOfBillId",
                          "raisedAt",
                          "raisedFor",
                          "readAgain",
                          "correction"
                        ],
                        "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/anomaly-desk/{proposalId}/resolve": {
      "post": {
        "operationId": "resolveAnomaly",
        "summary": "Resolves an anomaly with the action the person chose.",
        "description": "Resolves an anomaly with the action the person chose. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "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": 10,
                    "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": {
                  "type": "object",
                  "properties": {
                    "proposalId": {
                      "type": "string"
                    },
                    "resolvedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "resolvedBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "reason": {
                      "type": "string"
                    },
                    "draftBillId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "proposalId",
                    "resolvedAt",
                    "resolvedBy",
                    "reason",
                    "draftBillId"
                  ],
                  "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/api-keys": {
      "get": {
        "operationId": "listApiKeys",
        "summary": "Lists the API keys of the ledger, with their scopes and status.",
        "description": "Lists the API keys of the ledger, with their scopes and status. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "default": "active",
              "type": "string",
              "enum": [
                "active",
                "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/ListApiKeysResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "active": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "all": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "active",
                        "all"
                      ],
                      "additionalProperties": false
                    },
                    "access": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "open": {
                              "type": "boolean",
                              "const": true
                            }
                          },
                          "required": [
                            "open"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "open": {
                              "type": "boolean",
                              "const": false
                            },
                            "code": {
                              "type": "string",
                              "enum": [
                                "api_access_not_enabled",
                                "api_access_ledger_closed"
                              ]
                            },
                            "detail": {
                              "type": "string",
                              "minLength": 1
                            },
                            "remedy": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "open",
                            "code",
                            "detail",
                            "remedy"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "counts",
                    "access"
                  ],
                  "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/api-keys/deprecated-calls": {
      "get": {
        "operationId": "listApiKeyDeprecatedCalls",
        "summary": "Lists the days on which API keys called operations that are being retired, with the number of calls.",
        "description": "Lists the days on which API keys called operations that are being retired, with the number of calls. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "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
            }
          },
          {
            "name": "apiKeyId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "operation",
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "apiKeyId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "keyPrefix": {
                            "type": "string",
                            "minLength": 1
                          },
                          "operation": {
                            "type": "string",
                            "minLength": 1
                          },
                          "day": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "calls": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "apiKeyId",
                          "keyPrefix",
                          "operation",
                          "day",
                          "calls"
                        ],
                        "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/api-keys/{apiKeyId}/activity": {
      "get": {
        "operationId": "listApiKeyActivity",
        "summary": "Lists the requests made with an API key, newest first.",
        "description": "Lists the requests made with an API key, newest first. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "apiKeyId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "default": 30,
              "type": "integer",
              "minimum": 1,
              "maximum": 90
            }
          },
          {
            "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/History"
                    },
                    "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/api-keys/{apiKeyId}/revoke": {
      "post": {
        "operationId": "revokeApiKey",
        "summary": "Revokes an API key so it can no longer be used.",
        "description": "Revokes an API key so it can no longer be used. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "apiKeyId",
            "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
                  }
                },
                "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/ListApiKeysResponseItem"
                }
              }
            }
          },
          "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/approval-authorities": {
      "get": {
        "operationId": "listApprovalAuthorities",
        "summary": "Lists the approval authorities the ledger has granted, with their limits.",
        "description": "Lists the approval authorities the ledger has granted, with their limits. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "userId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "subjectKind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BILL",
                "ORDER",
                "RUN"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "default": "IN_FORCE",
              "type": "string",
              "enum": [
                "IN_FORCE",
                "ENDING",
                "EXPIRED",
                "CLOSED",
                "CARRIED_OVER",
                "ALL"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 80
            }
          },
          {
            "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/ListApprovalAuthoritiesResponseItem"
                      }
                    },
                    "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/approval-authorities/as-at/export": {
      "get": {
        "operationId": "approvalAuthoritiesAsAt",
        "summary": "Returns the approval authorities as they stood on a given date.",
        "description": "Returns the approval authorities as they stood on a given date. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "default": "PDF",
              "type": "string",
              "enum": [
                "PDF",
                "XLSX",
                "CSV"
              ]
            }
          },
          {
            "name": "entityId",
            "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": {
                    "filename": {
                      "type": "string"
                    },
                    "contentType": {
                      "type": "string"
                    },
                    "content": {
                      "type": "string"
                    },
                    "encoding": {
                      "type": "string",
                      "enum": [
                        "utf-8",
                        "base64"
                      ]
                    },
                    "rowCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "filename",
                    "contentType",
                    "content",
                    "encoding",
                    "rowCount"
                  ],
                  "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/approval-authorities/preview": {
      "get": {
        "operationId": "previewApprovalAuthority",
        "summary": "Previews an approval authority before it is granted.",
        "description": "Previews an approval authority before it is granted. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "userId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "subjectKind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "BILL",
                "ORDER",
                "RUN"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "scopeKind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "ANY",
                "ACCOUNT",
                "DIMENSION_VALUE",
                "VENDOR"
              ]
            }
          },
          {
            "name": "scopeRefId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "capMinor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "ownWorkCapMinor",
            "in": "query",
            "required": false,
            "schema": {
              "default": "0",
              "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": {
                    "from": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "to": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "considered": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "covered": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "wouldAllow": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "wouldRefuseOverCap": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "wouldRefuseOwnWork": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "largestCoveredMinor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "currency": {
                      "type": "string"
                    },
                    "refused": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "billId": {
                            "type": "string"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "supplierName": {
                            "type": "string"
                          },
                          "approvedByName": {
                            "type": "string"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "why": {
                            "type": "string",
                            "enum": [
                              "OVER_CAP",
                              "OWN_WORK"
                            ]
                          }
                        },
                        "required": [
                          "billId",
                          "number",
                          "supplierName",
                          "approvedByName",
                          "totalMinor",
                          "why"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "from",
                    "to",
                    "entityTimeZone",
                    "considered",
                    "covered",
                    "wouldAllow",
                    "wouldRefuseOverCap",
                    "wouldRefuseOwnWork",
                    "largestCoveredMinor",
                    "currency",
                    "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/approval-authorities/{authorityId}": {
      "get": {
        "operationId": "getApprovalAuthority",
        "summary": "Returns one approval authority and its history.",
        "description": "Returns one approval authority and its history. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "authorityId",
            "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/ListApprovalAuthoritiesResponseItem"
                }
              }
            }
          },
          "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/approval-authorities/{authorityId}/withdraw": {
      "post": {
        "operationId": "withdrawApprovalAuthority",
        "summary": "Withdraws an approval authority from a person.",
        "description": "Withdraws an approval authority from a person. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "authorityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "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/ListApprovalAuthoritiesResponseItem"
                }
              }
            }
          },
          "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/approval-substitutes": {
      "get": {
        "operationId": "listApprovalSubstitutes",
        "summary": "Lists the people covering approvals for someone away.",
        "description": "Lists the people covering approvals for someone away. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "userId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "current",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            }
          },
          {
            "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/ListApprovalSubstitutesResponseItem"
                      }
                    },
                    "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/approval-substitutes/{substituteId}/end": {
      "post": {
        "operationId": "endApprovalSubstitute",
        "summary": "Ends a substitute's cover for an approver.",
        "description": "Ends a substitute's cover for an approver. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "substituteId",
            "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/ListApprovalSubstitutesResponseItem"
                }
              }
            }
          },
          "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/assets": {
      "get": {
        "operationId": "listAssets",
        "summary": "Lists the fixed assets, with the server's total.",
        "description": "Lists the fixed assets, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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": [
                "ACTIVE",
                "DISPOSED",
                "FULLY_DEPRECIATED"
              ]
            }
          },
          {
            "name": "ccaClass",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "1",
                "3",
                "6",
                "8",
                "10",
                "12",
                "16",
                "43",
                "44",
                "46",
                "50",
                "53",
                "54",
                "55",
                "56",
                "10.1",
                "14.1",
                "43.1",
                "43.2"
              ]
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BILL",
                "MANUAL"
              ]
            }
          },
          {
            "name": "assetAccountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "acquiredOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "inServiceOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "costMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "salvageMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "method": {
                            "type": "string",
                            "enum": [
                              "STRAIGHT_LINE",
                              "DECLINING_BALANCE"
                            ]
                          },
                          "usefulLifeMonths": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "decliningRateE5": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "ccaClass": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "1",
                                  "3",
                                  "6",
                                  "8",
                                  "10",
                                  "12",
                                  "16",
                                  "43",
                                  "44",
                                  "46",
                                  "50",
                                  "53",
                                  "54",
                                  "55",
                                  "56",
                                  "10.1",
                                  "14.1",
                                  "43.1",
                                  "43.2"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "source": {
                            "$ref": "#/components/schemas/Source"
                          },
                          "isPassengerVehicle": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "ACTIVE",
                              "DISPOSED",
                              "FULLY_DEPRECIATED"
                            ]
                          },
                          "disposedOn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "disposalProceedsMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "disposalEntryId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "disposalEntryStatus": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "disposalBinds": {
                            "type": "boolean"
                          },
                          "accumulatedPostedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "netBookValueMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "pendingRows": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "assetAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "accumulatedAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "expenseAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "createdByName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "entityName",
                          "name",
                          "description",
                          "acquiredOn",
                          "inServiceOn",
                          "costMinor",
                          "salvageMinor",
                          "currency",
                          "method",
                          "usefulLifeMonths",
                          "decliningRateE5",
                          "ccaClass",
                          "source",
                          "isPassengerVehicle",
                          "status",
                          "disposedOn",
                          "disposalProceedsMinor",
                          "disposalEntryId",
                          "disposalEntryStatus",
                          "disposalBinds",
                          "accumulatedPostedMinor",
                          "netBookValueMinor",
                          "pendingRows",
                          "assetAccount",
                          "accumulatedAccount",
                          "expenseAccount",
                          "createdByName",
                          "createdAt"
                        ],
                        "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": "registerAsset",
        "summary": "Registers a fixed asset.",
        "description": "Registers a fixed asset. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterAssetRequest"
              }
            }
          }
        },
        "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/RegisterAssetResponse"
                }
              }
            }
          },
          "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/assets/{assetId}": {
      "get": {
        "operationId": "getAsset",
        "summary": "Returns one fixed asset with its depreciation.",
        "description": "Returns one fixed asset with its depreciation. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "assetId",
            "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/RegisterAssetResponse"
                }
              }
            }
          },
          "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/assets/{assetId}/dispose": {
      "post": {
        "operationId": "disposeAsset",
        "summary": "Disposes of a fixed asset and posts the gain or loss.",
        "description": "Disposes of a fixed asset and posts the gain or loss. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "disposedOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "proceedsMajor": {
                    "type": "string",
                    "pattern": "^\\d+(\\.\\d{1,2})?$"
                  },
                  "atArmsLength": {
                    "type": "boolean"
                  },
                  "cashAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "gainLossAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "memo": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "disposedOn",
                  "proceedsMajor",
                  "atArmsLength",
                  "cashAccountId",
                  "gainLossAccountId"
                ],
                "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/RegisterAssetResponse"
                }
              }
            }
          },
          "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/audit": {
      "get": {
        "operationId": "auditLog",
        "summary": "Lists the audit log of the ledger, newest first, with the server's total.",
        "description": "Lists the audit log of the ledger, newest first, with the server's total. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "targetType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "targetId",
            "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"
          },
          "422": {
            "$ref": "#/components/responses/Problem422"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/bank-accounts": {
      "get": {
        "operationId": "listBankAccounts",
        "summary": "Lists the bank accounts the ledger pays from.",
        "description": "Lists the bank accounts the ledger pays from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "coordinates",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "default": "BANK",
              "type": "string",
              "enum": [
                "BANK",
                "CARD",
                "STRIPE",
                "ANY"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "connectionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "notFedByQuickBooks",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "notConnectionId",
            "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": {
                        "$ref": "#/components/schemas/ListBankAccountsResponseItem"
                      }
                    },
                    "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/bank-accounts/{financialAccountId}/originator-changes/{changeId}/evidence-read": {
      "post": {
        "operationId": "readOriginatorEvidence",
        "summary": "Reads the evidence an originator change arrived with.",
        "description": "Reads the evidence an originator change arrived with. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "financialAccountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "changeId",
            "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": {
                    "read": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "documentKind": {
                              "type": "string",
                              "enum": [
                                "VOID_CHEQUE",
                                "BANK_LETTER",
                                "STATEMENT",
                                "OTHER"
                              ]
                            },
                            "holderNamePrinted": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "namesTheCompany": {
                              "type": "boolean"
                            },
                            "documentDate": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "legible": {
                              "type": "boolean"
                            },
                            "routing": {
                              "type": "string",
                              "enum": [
                                "AGREES",
                                "DIFFERS",
                                "NOT_FOUND"
                              ]
                            },
                            "originatorId": {
                              "type": "string",
                              "enum": [
                                "AGREES",
                                "NOT_FOUND"
                              ]
                            },
                            "accountsPrinted": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "holderName": {
                              "type": "string",
                              "enum": [
                                "AGREES",
                                "DIFFERS",
                                "NOT_FOUND"
                              ]
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "documentKind",
                            "holderNamePrinted",
                            "namesTheCompany",
                            "documentDate",
                            "legible",
                            "routing",
                            "originatorId",
                            "accountsPrinted",
                            "holderName",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "type": "string",
                      "enum": [
                        "NO_EVIDENCE",
                        "UNREADABLE",
                        "DISCLOSURE",
                        "BUDGET",
                        "PROVIDER",
                        "UNPARSABLE",
                        "REFUSED"
                      ]
                    }
                  },
                  "required": [
                    "read"
                  ],
                  "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/bank-accounts/{financialAccountId}/originator-changes/{changeId}/reject": {
      "post": {
        "operationId": "rejectOriginatorChange",
        "summary": "Rejects a proposed change to bank account originator details.",
        "description": "Rejects a proposed change to bank account originator details. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "financialAccountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "changeId",
            "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
                  },
                  "evidenceRead": {
                    "default": "NOT_READ",
                    "type": "string",
                    "enum": [
                      "AGREES",
                      "DIFFERS",
                      "NOT_READ",
                      "NO_EVIDENCE"
                    ]
                  },
                  "evidenceReadPromptVersion": {
                    "type": "string",
                    "maxLength": 40
                  }
                },
                "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/ListBankAccountsResponseItem"
                }
              }
            }
          },
          "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/bank-accounts/{financialAccountId}/originator-changes/{changeId}/withdraw": {
      "post": {
        "operationId": "withdrawOriginatorChange",
        "summary": "Withdraws a proposed change to bank account originator details.",
        "description": "Withdraws a proposed change to bank account originator details. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "financialAccountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "changeId",
            "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/ListBankAccountsResponseItem"
                }
              }
            }
          },
          "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/bank-file-tests": {
      "get": {
        "operationId": "listBankFileTests",
        "summary": "Lists the test payment files sent to each bank and their verdicts.",
        "description": "Lists the test payment files sent to each bank and their verdicts. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "bankProfileId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "paymentRunId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "answer",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "AWAITING",
                "ACCEPTED",
                "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": {
                        "$ref": "#/components/schemas/ListBankFileTestsResponseItem"
                      }
                    },
                    "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/bank-file-tests/{testId}": {
      "get": {
        "operationId": "getBankFileTest",
        "summary": "Returns one bank file test with its verdict.",
        "description": "Returns one bank file test with its verdict. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "testId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "coordinates",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "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": {
                  "$ref": "#/components/schemas/ListBankFileTestsResponseItem"
                }
              }
            }
          },
          "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/bank-file-tests/{testId}/verdict": {
      "post": {
        "operationId": "recordBankFileVerdict",
        "summary": "Records the bank's verdict on a test payment file.",
        "description": "Records the bank's verdict on a test payment file. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "testId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "verdict": {
                    "type": "string",
                    "enum": [
                      "ACCEPTED",
                      "REJECTED"
                    ]
                  },
                  "portalReference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "portalText": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  },
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  },
                  "evidenceDocumentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "rejectedFields": {
                    "maxItems": 13,
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Field"
                    }
                  },
                  "draft": {
                    "type": "object",
                    "properties": {
                      "promptVersion": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "proposedOutcome": {
                        "type": "string",
                        "enum": [
                          "ACCEPTED",
                          "REJECTED",
                          "UNCLEAR"
                        ]
                      },
                      "groundedRejections": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "droppedQuotes": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "instructionFound": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "promptVersion",
                      "proposedOutcome",
                      "groundedRejections",
                      "droppedQuotes",
                      "instructionFound"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "verdict"
                ],
                "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/ListBankFileTestsResponseItem"
                }
              }
            }
          },
          "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/bank-file-tests/{testId}/verdict/draft": {
      "post": {
        "operationId": "draftBankFileVerdict",
        "summary": "Drafts the verdict on a bank file test for a person to confirm.",
        "description": "Drafts the verdict on a bank file test for a person to confirm. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "testId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "portalText": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  }
                },
                "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": {
                    "drafted": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "outcome": {
                              "type": "string",
                              "enum": [
                                "ACCEPTED",
                                "REJECTED",
                                "UNCLEAR"
                              ]
                            },
                            "portalReference": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "rejections": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "field": {
                                    "$ref": "#/components/schemas/Field"
                                  },
                                  "recordType": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "enum": [
                                          "A",
                                          "C",
                                          "Z"
                                        ]
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "bankCode": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "quote": {
                                    "type": "string"
                                  },
                                  "remedy": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "field",
                                  "recordType",
                                  "bankCode",
                                  "quote",
                                  "remedy"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "instructionFound": {
                              "type": "boolean"
                            },
                            "droppedQuotes": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "note": {
                              "type": "string"
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "outcome",
                            "portalReference",
                            "rejections",
                            "instructionFound",
                            "droppedQuotes",
                            "note",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "NO_TEXT",
                            "UNREADABLE",
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNPARSABLE",
                            "REFUSED"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "drafted",
                    "why"
                  ],
                  "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/bank-profiles": {
      "get": {
        "operationId": "listBankProfiles",
        "summary": "Lists the bank profiles that describe how each bank's files are built.",
        "description": "Lists the bank profiles that describe how each bank's files are built. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "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/ListBankProfilesResponseItem"
                      }
                    },
                    "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/bank-profiles/{profileId}": {
      "get": {
        "operationId": "getBankProfile",
        "summary": "Returns one bank profile with its file layout.",
        "description": "Returns one bank profile with its file layout. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "profileId",
            "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/ListBankProfilesResponseItem"
                }
              }
            }
          },
          "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/banking-changes": {
      "get": {
        "operationId": "listBankingChanges",
        "summary": "Lists the changes to vendor banking details across the ledger.",
        "description": "Lists the changes to vendor banking details across the ledger. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "show",
            "in": "query",
            "required": false,
            "schema": {
              "default": "verifiable",
              "type": "string",
              "enum": [
                "verifiable",
                "mine",
                "all"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "batch",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "flag",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "disagrees",
                "noPaper",
                "signals",
                "expiring"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "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": {
                          "changeId": {
                            "type": "string"
                          },
                          "vendorId": {
                            "type": "string"
                          },
                          "vendorName": {
                            "type": "string"
                          },
                          "scheme": {
                            "type": "string",
                            "enum": [
                              "CA_EFT",
                              "IBAN",
                              "US_ABA",
                              "SWIFT_ACCOUNT"
                            ]
                          },
                          "bankCountry": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "proposedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "proposedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "source": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "HAND"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "BATCH"
                                  },
                                  "importId": {
                                    "type": "string"
                                  },
                                  "fileName": {
                                    "type": "string"
                                  },
                                  "line": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "importId",
                                  "fileName",
                                  "line"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          },
                          "paper": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "documentId": {
                                    "type": "string"
                                  },
                                  "fileName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "documentId",
                                  "fileName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "intakeCheck": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "NOT_ASKED",
                                      "WAITING",
                                      "READ",
                                      "NOT_READ",
                                      "STALE"
                                    ]
                                  },
                                  "routing": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "enum": [
                                          "AGREES",
                                          "DIFFERS",
                                          "NOT_FOUND"
                                        ]
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "holderVsFile": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "enum": [
                                          "AGREES",
                                          "DIFFERS",
                                          "NOT_FOUND"
                                        ]
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "state",
                                  "routing",
                                  "holderVsFile"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "signals": {
                            "type": "object",
                            "properties": {
                              "open": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "kinds": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "enum": [
                                    "HOLDER_NAME_MISMATCH",
                                    "NO_EVIDENCE",
                                    "NEW_SENDER_DOMAIN",
                                    "CHANGE_BEFORE_A_LARGE_BILL",
                                    "SHORT_INTERVAL",
                                    "SHARED_ACCOUNT"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "open",
                              "kinds"
                            ],
                            "additionalProperties": false
                          },
                          "you": {
                            "type": "object",
                            "properties": {
                              "mayVerify": {
                                "type": "boolean"
                              },
                              "whyNot": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "OWN_PROPOSAL",
                                      "SAME_HAND",
                                      "COMPANY_SCOPE",
                                      "NO_SEAT"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "mayWithdraw": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "mayVerify",
                              "whyNot",
                              "mayWithdraw"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "changeId",
                          "vendorId",
                          "vendorName",
                          "scheme",
                          "bankCountry",
                          "proposedBy",
                          "proposedAt",
                          "expiresAt",
                          "source",
                          "paper",
                          "intakeCheck",
                          "signals",
                          "you"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "bankingCallbackWindowDays": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "entityTimeZone",
                    "bankingCallbackWindowDays"
                  ],
                  "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/banking-minimisations": {
      "get": {
        "operationId": "listBankingMinimisations",
        "summary": "Lists the banking details minimised on the ledger.",
        "description": "Lists the banking details minimised on the ledger. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "reason",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "REJECTED",
                "WITHDRAWN",
                "EXPIRED",
                "SUPERSEDED_UNPAID",
                "PERMISSION_RECORDED"
              ]
            }
          },
          {
            "name": "changeIds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 12800
            }
          },
          {
            "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": {
                          "changeId": {
                            "type": "string"
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "scheme": {
                            "type": "string"
                          },
                          "bankCountry": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reason": {
                            "type": "string",
                            "enum": [
                              "REJECTED",
                              "WITHDRAWN",
                              "EXPIRED",
                              "SUPERSEDED_UNPAID",
                              "PERMISSION_RECORDED"
                            ]
                          },
                          "basis": {
                            "type": "string",
                            "enum": [
                              "RETENTION_RULE",
                              "CRA_PERMISSION"
                            ]
                          },
                          "proposedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "decidedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "destroyedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "requestId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entityTimeZone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "changeId",
                          "vendor",
                          "scheme",
                          "bankCountry",
                          "reason",
                          "basis",
                          "proposedAt",
                          "decidedAt",
                          "destroyedAt",
                          "requestId",
                          "entityTimeZone"
                        ],
                        "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/bill-approval-stages": {
      "get": {
        "operationId": "listBillApprovalStages",
        "summary": "Lists the approval stages bills go through, with the people at each.",
        "description": "Lists the approval stages bills go through, with the people at each. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "ruleId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "deskUserId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "WAITING",
                "APPROVED",
                "DECLINED",
                "REASSIGNED",
                "ESCALATED",
                "WITHDRAWN"
              ]
            }
          },
          {
            "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}$"
            }
          },
          {
            "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"
                          },
                          "billId": {
                            "type": "string"
                          },
                          "supplierName": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "subject": {
                            "type": "string",
                            "enum": [
                              "BILL",
                              "BILL_EDIT"
                            ]
                          },
                          "revision": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "position": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "stageCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "REVIEW",
                              "SIGN"
                            ]
                          },
                          "desk": {
                            "$ref": "#/components/schemas/Desk"
                          },
                          "rule": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "version": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "sourceText": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "version",
                                  "sourceText"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "reason": {
                            "type": "string"
                          },
                          "routedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "routedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "actorType": {
                            "type": "string",
                            "enum": [
                              "USER",
                              "AGENT",
                              "SYSTEM"
                            ]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "WAITING",
                              "APPROVED",
                              "DECLINED",
                              "REASSIGNED",
                              "ESCALATED",
                              "WITHDRAWN"
                            ]
                          },
                          "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"
                              }
                            ]
                          },
                          "onBehalfOf": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "decisionNote": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "closedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "closedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "closeReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "billId",
                          "supplierName",
                          "entityName",
                          "entityTimeZone",
                          "subject",
                          "revision",
                          "position",
                          "stageCount",
                          "kind",
                          "desk",
                          "rule",
                          "reason",
                          "routedAt",
                          "routedBy",
                          "actorType",
                          "state",
                          "decidedBy",
                          "decidedAt",
                          "onBehalfOf",
                          "decisionNote",
                          "closedBy",
                          "closedAt",
                          "closeReason"
                        ],
                        "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/bill-proposals": {
      "get": {
        "operationId": "listBillProposals",
        "summary": "Lists the bills proposed from outside documents, waiting for a decision.",
        "description": "Lists the bills proposed from outside documents, waiting for a decision. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BILL",
                "BILL_EDIT"
              ]
            }
          },
          {
            "name": "awaiting",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "myApproval"
              ]
            }
          },
          {
            "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"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "BILL",
                              "BILL_EDIT"
                            ]
                          },
                          "billId": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "supplierName": {
                            "type": "string"
                          },
                          "vendor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billDate": {
                            "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+$"
                          },
                          "previousTotalMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "submittedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "submittedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "draftedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "INBOX_DOCUMENT",
                              "MANUAL",
                              "IMPORT",
                              "RECURRING"
                            ]
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "desk": {
                            "$ref": "#/components/schemas/Desk2"
                          }
                        },
                        "required": [
                          "proposalId",
                          "kind",
                          "billId",
                          "entityId",
                          "entityName",
                          "supplierName",
                          "vendor",
                          "number",
                          "billDate",
                          "dueDate",
                          "currency",
                          "totalMinor",
                          "previousTotalMinor",
                          "lineCount",
                          "submittedAt",
                          "submittedBy",
                          "draftedBy",
                          "source",
                          "note",
                          "desk"
                        ],
                        "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/bills": {
      "get": {
        "operationId": "listBills",
        "summary": "Lists the bills on the ledger, with the server's total.",
        "description": "Lists the bills on the ledger, with the server's total. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "IN_REVIEW",
                "DECLINED",
                "APPROVED",
                "HELD",
                "OPEN",
                "DUE",
                "OVERDUE",
                "IN_RUN",
                "PARTIALLY_PAID",
                "PAID",
                "VOID"
              ]
            }
          },
          {
            "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": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "due",
                "other",
                "recover"
              ]
            }
          },
          {
            "name": "when",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "overdue",
                "week"
              ]
            }
          },
          {
            "name": "awaiting",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "myApproval"
              ]
            }
          },
          {
            "name": "held",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "only"
              ]
            }
          },
          {
            "name": "closePeriod",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
            }
          },
          {
            "name": "conversion",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "untested"
              ]
            }
          },
          {
            "name": "itc",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "fails",
                "untested",
                "passes"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "owing",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "only"
              ]
            }
          },
          {
            "name": "supersedes",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "replaceable",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "only"
              ]
            }
          },
          {
            "name": "discount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "open"
              ]
            }
          },
          {
            "name": "holdback",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ANY",
                "RETAINED",
                "RELEASE_DUE",
                "RELEASED"
              ]
            }
          },
          {
            "name": "question",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "WAITING",
                "ANSWERED",
                "UNRESOLVED",
                "MINE"
              ]
            }
          },
          {
            "name": "billDateFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "billDateTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "submittedById",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "amountFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "amountTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "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/ListBillsResponseItem"
                      }
                    },
                    "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": "createBill",
        "summary": "Creates a draft bill from a vendor's invoice.",
        "description": "Creates a draft bill from a vendor's invoice. Needs the `ledger:propose` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "vendorId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "supplierName": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "supplierRegistrationNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{9}RT\\d{4}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "number": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "billDate": {
                    "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}$"
                  },
                  "memo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "deliveryRegion": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^(CA|US)-[A-Z]{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines3"
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields3"
                  },
                  "submit": {
                    "default": false,
                    "type": "boolean"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "supersedesBillId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "entityId",
                  "billDate",
                  "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/RecordBillFxRateResponse"
                }
              }
            }
          },
          "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/bills-due": {
      "get": {
        "operationId": "listBillsDue",
        "summary": "Lists the bills that fall due, by date, with the server's total.",
        "description": "Lists the bills that fall due, by date, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "when",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "overdue",
                "week"
              ]
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "due",
                "other",
                "recover"
              ]
            }
          },
          {
            "name": "held",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "only"
              ]
            }
          },
          {
            "name": "discount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "open"
              ]
            }
          },
          {
            "name": "plan",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "set",
                "unset",
                "slipped"
              ]
            }
          },
          {
            "name": "account",
            "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": {
                          "billId": {
                            "type": "string"
                          },
                          "extractionId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "documentId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "supplierName": {
                            "type": "string"
                          },
                          "vendor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "ACTIVE",
                                      "ARCHIVED"
                                    ]
                                  },
                                  "bankingState": {
                                    "type": "string",
                                    "enum": [
                                      "NONE",
                                      "PENDING",
                                      "VERIFIED"
                                    ]
                                  },
                                  "bankingVerifiedOn": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "acceptance": {
                                    "default": null,
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "state": {
                                            "type": "string",
                                            "enum": [
                                              "PENDING_ACCEPTANCE",
                                              "ACCEPTED",
                                              "REFUSED",
                                              "NOT_REVIEWED"
                                            ]
                                          },
                                          "createdByName": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "state",
                                          "createdByName"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "paymentHold": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "reason": {
                                            "type": "string"
                                          },
                                          "byName": {
                                            "type": "string"
                                          },
                                          "heldOn": {
                                            "type": "string",
                                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                          }
                                        },
                                        "required": [
                                          "reason",
                                          "byName",
                                          "heldOn"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "bankingReturned": {
                                    "default": null,
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "returnedOn": {
                                            "type": "string",
                                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                          },
                                          "returnCode": {
                                            "type": "string",
                                            "enum": [
                                              "R900",
                                              "R902",
                                              "R903",
                                              "R904",
                                              "R905",
                                              "R909",
                                              "R910",
                                              "R911",
                                              "R912",
                                              "R922",
                                              "R990",
                                              "OTHER"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "returnedOn",
                                          "returnCode"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName",
                                  "status",
                                  "bankingState",
                                  "bankingVerifiedOn",
                                  "acceptance",
                                  "paymentHold",
                                  "bankingReturned"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "invoiceNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "invoiceDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "dueDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "overdueDays": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "entryId": {
                            "type": "string"
                          },
                          "entryNumber": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "payability": {
                            "type": "string",
                            "enum": [
                              "PAYABLE",
                              "BILL_HELD",
                              "NO_VENDOR",
                              "VENDOR_ARCHIVED",
                              "VENDOR_HELD",
                              "VENDOR_NOT_ACCEPTED",
                              "NO_BANKING",
                              "BANKING_PENDING",
                              "BANKING_RETURNED",
                              "BANKING_FOREIGN",
                              "IN_RUN"
                            ]
                          },
                          "inRun": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "DRAFT",
                                      "RELEASED",
                                      "CANCELLED"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "status"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "hold": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "reason": {
                                    "type": "string"
                                  },
                                  "byName": {
                                    "type": "string"
                                  },
                                  "heldOn": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "until": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "untilPassed": {
                                    "type": "boolean"
                                  },
                                  "policyAuthorName": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "reason",
                                  "byName",
                                  "heldOn",
                                  "until",
                                  "untilPassed",
                                  "policyAuthorName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "paidBy": {
                            "type": "string",
                            "enum": [
                              "RUN",
                              "CARD",
                              "PAD",
                              "ACCOUNT",
                              "CHEQUE",
                              "WIRE",
                              "ETRANSFER",
                              "OTHER"
                            ]
                          },
                          "pendingSettlement": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "method": {
                                    "type": "string",
                                    "enum": [
                                      "RUN",
                                      "CARD",
                                      "PAD",
                                      "ACCOUNT",
                                      "CHEQUE",
                                      "WIRE",
                                      "ETRANSFER",
                                      "OTHER"
                                    ]
                                  },
                                  "settledOn": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "recordedBy": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "recordedAt": {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  "account": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "displayName": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "displayName"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "paidAmountMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "paidCurrency": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  },
                                  "approveBlocked": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "method",
                                  "settledOn",
                                  "recordedBy",
                                  "recordedAt",
                                  "account",
                                  "paidAmountMinor",
                                  "paidCurrency",
                                  "approveBlocked"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "vendorSlipKind": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "T4A",
                                  "T5018",
                                  "T4A_NR"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "neverInRun": {
                            "type": "boolean"
                          },
                          "approvedOn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "approvedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "priorMethods": {
                            "$ref": "#/components/schemas/PriorMethods"
                          },
                          "stillOwedConfirmedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "shortPaid": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "runId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "settledOn": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "reason": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "runId",
                                  "settledOn",
                                  "reason"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "discount": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "discountDate": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "amountMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "words": {
                                    "type": "string"
                                  },
                                  "open": {
                                    "type": "boolean"
                                  },
                                  "closesInDays": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "earlierSettlement": {
                                    "type": "boolean"
                                  },
                                  "terms": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "name"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "account": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "code": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          },
                                          "type": {
                                            "type": "string",
                                            "enum": [
                                              "ASSET",
                                              "LIABILITY",
                                              "EQUITY",
                                              "REVENUE",
                                              "EXPENSE"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "code",
                                          "name",
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "discountDate",
                                  "amountMinor",
                                  "words",
                                  "open",
                                  "closesInDays",
                                  "earlierSettlement",
                                  "terms",
                                  "account"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "methodPayability": {
                            "type": "object",
                            "properties": {
                              "EFT": {
                                "type": "string",
                                "enum": [
                                  "PAYABLE",
                                  "BILL_HELD",
                                  "NO_VENDOR",
                                  "VENDOR_ARCHIVED",
                                  "VENDOR_HELD",
                                  "VENDOR_NOT_ACCEPTED",
                                  "NO_BANKING",
                                  "BANKING_PENDING",
                                  "BANKING_RETURNED",
                                  "BANKING_FOREIGN",
                                  "IN_RUN"
                                ]
                              },
                              "CHEQUE": {
                                "type": "string",
                                "enum": [
                                  "PAYABLE",
                                  "BILL_HELD",
                                  "NO_VENDOR",
                                  "VENDOR_ARCHIVED",
                                  "VENDOR_HELD",
                                  "VENDOR_NOT_ACCEPTED",
                                  "NO_BANKING",
                                  "BANKING_PENDING",
                                  "BANKING_RETURNED",
                                  "BANKING_FOREIGN",
                                  "IN_RUN"
                                ]
                              },
                              "WIRE": {
                                "type": "string",
                                "enum": [
                                  "PAYABLE",
                                  "BILL_HELD",
                                  "NO_VENDOR",
                                  "VENDOR_ARCHIVED",
                                  "VENDOR_HELD",
                                  "VENDOR_NOT_ACCEPTED",
                                  "NO_BANKING",
                                  "BANKING_PENDING",
                                  "BANKING_RETURNED",
                                  "BANKING_FOREIGN",
                                  "IN_RUN"
                                ]
                              }
                            },
                            "required": [
                              "EFT",
                              "CHEQUE",
                              "WIRE"
                            ],
                            "additionalProperties": false
                          },
                          "feedCandidate": {
                            "$ref": "#/components/schemas/FeedCandidate"
                          },
                          "duplicateSignal": {
                            "$ref": "#/components/schemas/Stored"
                          },
                          "openCredit": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "remainingMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "credits": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "remainingMinor",
                                  "credits"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "vendorPaper": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "rollup": {
                                    "type": "string",
                                    "enum": [
                                      "NONE_REQUIRED",
                                      "CURRENT",
                                      "EXPIRING",
                                      "NOT_CURRENT"
                                    ]
                                  },
                                  "gaps": {
                                    "maxItems": 3,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "WSIB_CLEARANCE",
                                            "INSURANCE_CERTIFICATE",
                                            "MASTER_AGREEMENT",
                                            "W8BEN",
                                            "DIRECT_DEPOSIT_FORM",
                                            "WITHHOLDING_WAIVER",
                                            "OTHER"
                                          ]
                                        },
                                        "state": {
                                          "type": "string",
                                          "enum": [
                                            "CURRENT",
                                            "EXPIRING",
                                            "LAPSED",
                                            "MISSING"
                                          ]
                                        },
                                        "validUntil": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "state",
                                        "validUntil"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "more": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "rollup",
                                  "gaps",
                                  "more"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "withholding": {
                            "type": "object",
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "NOT_APPLICABLE",
                                  "RESIDENCY_UNSTATED",
                                  "UNDECIDED",
                                  "NO_SERVICE_IN_CANADA",
                                  "WITHHOLDS",
                                  "WAIVED"
                                ]
                              },
                              "undecidedLines": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "markedNetMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "billTotalMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "rateBp": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "waiver": {
                                "$ref": "#/components/schemas/Waiver"
                              }
                            },
                            "required": [
                              "state",
                              "undecidedLines",
                              "markedNetMinor",
                              "billTotalMinor",
                              "rateBp",
                              "waiver"
                            ],
                            "additionalProperties": false
                          },
                          "holdback": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "NONE",
                                      "RETAINED",
                                      "RELEASE_DUE",
                                      "RELEASE_DRAFTED",
                                      "PART_RELEASED",
                                      "RELEASED",
                                      "IS_RELEASE"
                                    ]
                                  },
                                  "retainedMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "releasedMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "remainingMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "releaseOn": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "parent": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "billId": {
                                            "type": "string"
                                          },
                                          "number": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "billId",
                                          "number"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "state",
                                  "retainedMinor",
                                  "releasedMinor",
                                  "remainingMinor",
                                  "releaseOn",
                                  "parent"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "plan": {
                            "$ref": "#/components/schemas/Plan"
                          },
                          "stake": {
                            "type": "object",
                            "properties": {
                              "tier": {
                                "anyOf": [
                                  {
                                    "type": "number",
                                    "const": 1
                                  },
                                  {
                                    "type": "number",
                                    "const": 2
                                  },
                                  {
                                    "type": "number",
                                    "const": 3
                                  }
                                ]
                              },
                              "reason": {
                                "type": "string",
                                "enum": [
                                  "DISCOUNT_LAPSES",
                                  "INTEREST_RUNNING",
                                  "PAST_DUE",
                                  "DUE"
                                ]
                              },
                              "closesInDays": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "discountMinor": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "discountBp": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "interest": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "monthlyBp": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "annualBp": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "perDayMinor": {
                                        "type": "string",
                                        "pattern": "^-?\\d+$"
                                      }
                                    },
                                    "required": [
                                      "monthlyBp",
                                      "annualBp",
                                      "perDayMinor"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "tier",
                              "reason",
                              "closesInDays",
                              "discountMinor",
                              "discountBp",
                              "interest"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "billId",
                          "extractionId",
                          "documentId",
                          "entityId",
                          "entityName",
                          "supplierName",
                          "vendor",
                          "invoiceNumber",
                          "invoiceDate",
                          "dueDate",
                          "overdueDays",
                          "currency",
                          "amountMinor",
                          "entryId",
                          "entryNumber",
                          "payability",
                          "inRun",
                          "hold",
                          "paidBy",
                          "pendingSettlement",
                          "vendorSlipKind",
                          "neverInRun",
                          "approvedOn",
                          "approvedBy",
                          "priorMethods",
                          "stillOwedConfirmedAt",
                          "totalMinor",
                          "shortPaid",
                          "discount",
                          "methodPayability",
                          "feedCandidate",
                          "duplicateSignal",
                          "openCredit",
                          "vendorPaper",
                          "withholding",
                          "holdback",
                          "plan",
                          "stake"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "exchangeDifferences": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "accountNominated": {
                            "type": "boolean"
                          },
                          "unclearedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "entityId",
                          "entityName",
                          "currency",
                          "accountNominated",
                          "unclearedMinor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "totals": {
                      "$ref": "#/components/schemas/Totals3"
                    },
                    "tiedOut": {
                      "type": "boolean"
                    },
                    "bankingCallbackWindowDays": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 365
                    },
                    "heldCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "viewTotals": {
                      "type": "object",
                      "properties": {
                        "due": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "other": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "recover": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "due",
                        "other",
                        "recover"
                      ],
                      "additionalProperties": false
                    },
                    "tieOut": {
                      "$ref": "#/components/schemas/Rows3"
                    },
                    "discountTotals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "bills": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "discountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "firstClosesOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          }
                        },
                        "required": [
                          "entityId",
                          "entityName",
                          "currency",
                          "bills",
                          "discountMinor",
                          "firstClosesOn"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "feedTruncated": {
                      "type": "boolean"
                    },
                    "heldBack": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "remainingMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "entityId",
                          "currency",
                          "remainingMinor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "bridge": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "queueMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "heldMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "paidAnotherWayMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "billsElsewhereMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "unappliedCreditMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "settlementResidualMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "unexplainedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "controlMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "entityId",
                          "entityName",
                          "currency",
                          "queueMinor",
                          "heldMinor",
                          "paidAnotherWayMinor",
                          "billsElsewhereMinor",
                          "unappliedCreditMinor",
                          "settlementResidualMinor",
                          "unexplainedMinor",
                          "controlMinor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "planBand": {
                      "type": "object",
                      "properties": {
                        "companies": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "entityId": {
                                "type": "string"
                              },
                              "entityName": {
                                "type": "string"
                              },
                              "today": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              }
                            },
                            "required": [
                              "entityId",
                              "entityName",
                              "today"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "days": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "entityId": {
                                "type": "string"
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "on": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "bills": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "openMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              }
                            },
                            "required": [
                              "entityId",
                              "currency",
                              "on",
                              "bills",
                              "openMinor"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "later": {
                          "$ref": "#/components/schemas/Later"
                        },
                        "slipped": {
                          "$ref": "#/components/schemas/Later"
                        },
                        "unplanned": {
                          "$ref": "#/components/schemas/Later"
                        },
                        "held": {
                          "$ref": "#/components/schemas/Later"
                        }
                      },
                      "required": [
                        "companies",
                        "days",
                        "later",
                        "slipped",
                        "unplanned",
                        "held"
                      ],
                      "additionalProperties": false
                    },
                    "cash": {
                      "maxItems": 5,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "OK",
                              "NO_ACCOUNT",
                              "NO_BALANCE"
                            ]
                          },
                          "account": {
                            "anyOf": [
                              {
                                "$ref": "#/components/schemas/AccountOption1"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "source": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "NOMINATED",
                                  "LAST_RUN",
                                  "CHOSEN"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "runway": {
                            "anyOf": [
                              {
                                "$ref": "#/components/schemas/RunwayOption1"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "otherCurrencies": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "currency": {
                                  "type": "string",
                                  "pattern": "^[A-Z]{3}$"
                                },
                                "bills": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "currency",
                                "bills"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "lastPlan": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "PROPOSED",
                                      "APPLIED",
                                      "DISCARDED"
                                    ]
                                  },
                                  "decidedAt": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "minLength": 20
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "decidedBy": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "name"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "applied": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "changed": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "declined": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "id",
                                  "state",
                                  "decidedAt",
                                  "decidedBy",
                                  "applied",
                                  "changed",
                                  "declined"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "state",
                          "account",
                          "source",
                          "runway",
                          "otherCurrencies",
                          "lastPlan"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "stakeCaption": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "exchangeDifferences",
                    "totals",
                    "tiedOut",
                    "bankingCallbackWindowDays",
                    "heldCount",
                    "viewTotals",
                    "tieOut",
                    "discountTotals",
                    "feedTruncated",
                    "heldBack",
                    "planBand",
                    "cash",
                    "stakeCaption"
                  ],
                  "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/bills/bulk/add-to-run": {
      "post": {
        "operationId": "bulkAddBillsToRun",
        "summary": "Previews adding several bills to one payment run and saves nothing.",
        "description": "Previews adding several bills to one payment run and saves nothing. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkHoldVendorPaymentsRequest"
              }
            }
          }
        },
        "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/BulkHoldVendorPaymentsResponse"
                }
              }
            }
          },
          "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/bills/bulk/approve": {
      "post": {
        "operationId": "bulkApproveBills",
        "summary": "Approves several bills in one request, each checked on its own.",
        "description": "Approves several bills in one request, each checked on its own. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkHoldVendorPaymentsRequest"
              }
            }
          }
        },
        "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/BulkHoldVendorPaymentsResponse"
                }
              }
            }
          },
          "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/bills/bulk/hold": {
      "post": {
        "operationId": "bulkHoldBills",
        "summary": "Puts several bills on hold in one request.",
        "description": "Puts several bills on hold in one request. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkHoldVendorPaymentsRequest"
              }
            }
          }
        },
        "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/BulkHoldVendorPaymentsResponse"
                }
              }
            }
          },
          "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/bills/bulk/plan": {
      "post": {
        "operationId": "bulkPlanBills",
        "summary": "Sets the payment plan for several bills in one request.",
        "description": "Sets the payment plan for several bills in one request. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkHoldVendorPaymentsRequest"
              }
            }
          }
        },
        "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/BulkHoldVendorPaymentsResponse"
                }
              }
            }
          },
          "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/bills/bulk/plan/clear": {
      "post": {
        "operationId": "bulkClearBillPlans",
        "summary": "Clears the payment plans of several bills in one request.",
        "description": "Clears the payment plans of several bills in one request. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkHoldVendorPaymentsRequest"
              }
            }
          }
        },
        "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/BulkHoldVendorPaymentsResponse"
                }
              }
            }
          },
          "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/bills/bulk/release-hold": {
      "post": {
        "operationId": "bulkReleaseBillHolds",
        "summary": "Releases the holds on several bills in one request.",
        "description": "Releases the holds on several bills in one request. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkHoldVendorPaymentsRequest"
              }
            }
          }
        },
        "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/BulkHoldVendorPaymentsResponse"
                }
              }
            }
          },
          "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/bills/bulk/submit": {
      "post": {
        "operationId": "bulkSubmitBills",
        "summary": "Submits several bills for approval in one request.",
        "description": "Submits several bills for approval in one request. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkHoldVendorPaymentsRequest"
              }
            }
          }
        },
        "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/BulkHoldVendorPaymentsResponse"
                }
              }
            }
          },
          "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/bills/dimension-proposals": {
      "post": {
        "operationId": "proposeBillDimensions",
        "summary": "Suggests the dimensions a bill's lines belong to and saves nothing.",
        "description": "Suggests the dimensions a bill's lines belong to and saves nothing. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
                  },
                  "vendorId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "lines": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "accountId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "taggedTypeIds": {
                          "maxItems": 20,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "key",
                        "accountId",
                        "description",
                        "taggedTypeIds"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "entityId",
                  "vendorId",
                  "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": {
                    "proposals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "lineKey": {
                            "type": "string"
                          },
                          "dimensionTypeId": {
                            "type": "string"
                          },
                          "typeLabel": {
                            "type": "string"
                          },
                          "dimensionValueId": {
                            "type": "string"
                          },
                          "valueCode": {
                            "type": "string"
                          },
                          "valueName": {
                            "type": "string"
                          },
                          "basis": {
                            "type": "string",
                            "enum": [
                              "HISTORY",
                              "MODEL"
                            ]
                          },
                          "evidence": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "agreeing": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 9007199254740991
                                  },
                                  "window": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 5
                                  },
                                  "bills": {
                                    "maxItems": 5,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "billId": {
                                          "type": "string"
                                        },
                                        "number": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "billDate": {
                                          "type": "string",
                                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                        }
                                      },
                                      "required": [
                                        "billId",
                                        "number",
                                        "billDate"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "agreeing",
                                  "window",
                                  "bills"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "lineKey",
                          "dimensionTypeId",
                          "typeLabel",
                          "dimensionValueId",
                          "valueCode",
                          "valueName",
                          "basis",
                          "evidence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "hiddenAfterDecline": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "modelWhy": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNPARSABLE",
                            "REFUSED",
                            "UNKNOWN_REF",
                            "STOPPED_AFTER_THREE_DECLINES"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "modelLinesLeftOut": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "skippedTypes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "dimensionTypeId": {
                            "type": "string"
                          },
                          "typeLabel": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "dimensionTypeId",
                          "typeLabel"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "proposals",
                    "hiddenAfterDecline",
                    "modelWhy",
                    "modelLinesLeftOut",
                    "skippedTypes"
                  ],
                  "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/bills/dimension-proposals/decline": {
      "post": {
        "operationId": "declineBillDimensionProposal",
        "summary": "Declines a proposal of dimensions for a bill.",
        "description": "Declines a proposal of dimensions for a bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "vendorId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "accountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "dimensionTypeId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "dimensionValueId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "basis": {
                    "type": "string",
                    "enum": [
                      "HISTORY",
                      "MODEL"
                    ]
                  },
                  "replacedByValueId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "vendorId",
                  "accountId",
                  "dimensionTypeId",
                  "dimensionValueId",
                  "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/DeclinePurchaseOrderSuggestionResponse"
                }
              }
            }
          },
          "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/bills/key-check": {
      "get": {
        "operationId": "checkBillKeying",
        "summary": "Checks a bill's keying for duplicates and mistakes before it is saved.",
        "description": "Checks a bill's keying for duplicates and mistakes before it is saved. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "supplierName",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "number",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            }
          },
          {
            "name": "billDate",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "totalMinor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          {
            "name": "documentId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "excludeBillId",
            "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": {
                    "ranNumber": {
                      "type": "boolean"
                    },
                    "ranResemblance": {
                      "type": "boolean"
                    },
                    "holders": {
                      "maxItems": 5,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "billId": {
                            "type": "string"
                          },
                          "supplierName": {
                            "type": "string"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "IN_REVIEW",
                              "DECLINED",
                              "APPROVED",
                              "HELD",
                              "OPEN",
                              "DUE",
                              "OVERDUE",
                              "IN_RUN",
                              "PARTIALLY_PAID",
                              "PAID",
                              "VOID"
                            ]
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "blocksSubmit": {
                            "type": "boolean"
                          },
                          "draftedByYou": {
                            "type": "boolean"
                          },
                          "sentence": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "billId",
                          "supplierName",
                          "number",
                          "billDate",
                          "status",
                          "totalMinor",
                          "currency",
                          "blocksSubmit",
                          "draftedByYou",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "holdersMore": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "resemblances": {
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "signal": {
                            "type": "string",
                            "enum": [
                              "CONTENT_HASH",
                              "INVOICE_NUMBER",
                              "VENDOR_AMOUNT_WINDOW",
                              "VENDOR_CADENCE",
                              "CODED_FEED_LINE"
                            ]
                          },
                          "severity": {
                            "type": "string",
                            "enum": [
                              "HARD_STOP",
                              "FLAG"
                            ]
                          },
                          "sentence": {
                            "type": "string",
                            "minLength": 1
                          },
                          "bill": {
                            "anyOf": [
                              {
                                "$ref": "#/components/schemas/BillOption1"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "signal",
                          "severity",
                          "sentence",
                          "bill"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "resemblancesMore": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "usual": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "minimum": 3,
                              "maximum": 9007199254740991
                            },
                            "lowMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "highMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "currency": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            }
                          },
                          "required": [
                            "count",
                            "lowMinor",
                            "highMinor",
                            "currency"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "ranNumber",
                    "ranResemblance",
                    "holders",
                    "holdersMore",
                    "resemblances",
                    "resemblancesMore",
                    "usual"
                  ],
                  "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/bills/order-proposals": {
      "post": {
        "operationId": "proposeBillOrders",
        "summary": "Suggests the purchase orders a bill matches and saves nothing.",
        "description": "Suggests the purchase orders a bill matches and saves nothing. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
                  },
                  "vendorId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "billId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "orderReference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "lines": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "quantity": {
                          "type": "string",
                          "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                        },
                        "netMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "unitPriceMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "key",
                        "description",
                        "quantity",
                        "netMinor"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "entityId",
                  "vendorId",
                  "currency",
                  "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": {
                    "proposals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "lineKey": {
                            "type": "string"
                          },
                          "purchaseOrderLineId": {
                            "type": "string"
                          },
                          "orderId": {
                            "type": "string"
                          },
                          "orderNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "orderLinePosition": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "description": {
                            "type": "string"
                          },
                          "basis": {
                            "type": "string",
                            "enum": [
                              "DOCUMENT_NUMBER",
                              "SUPPLIER_ITEM",
                              "PRICE_AND_QUANTITY",
                              "MODEL"
                            ]
                          },
                          "evidence": {
                            "type": "object",
                            "properties": {
                              "orderQuantity": {
                                "type": "string",
                                "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                              },
                              "billedElsewhere": {
                                "type": "string",
                                "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                              },
                              "receivedQuantity": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "unitPriceMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "descriptionScore": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 100
                              },
                              "orderReference": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "orderQuantity",
                              "billedElsewhere",
                              "receivedQuantity",
                              "unitPriceMinor",
                              "currency",
                              "descriptionScore",
                              "orderReference"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "lineKey",
                          "purchaseOrderLineId",
                          "orderId",
                          "orderNumber",
                          "orderLinePosition",
                          "description",
                          "basis",
                          "evidence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "hiddenAfterDecline": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "referenceFound": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string"
                            },
                            "found": {
                              "type": "boolean"
                            },
                            "orderNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "text",
                            "found",
                            "orderNumber"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "modelWhy": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "PROVIDER",
                            "BUDGET",
                            "REFUSED",
                            "UNPARSABLE",
                            "UNKNOWN_REF",
                            "STOPPED_AFTER_THREE_DECLINES",
                            "NOTHING_TO_READ",
                            "TOO_MANY_LINES"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "modelLinesLeftOut": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "proposals",
                    "hiddenAfterDecline",
                    "referenceFound",
                    "modelWhy",
                    "modelLinesLeftOut"
                  ],
                  "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/bills/order-proposals/decline": {
      "post": {
        "operationId": "declineBillOrderProposal",
        "summary": "Declines a proposed purchase order match for a bill.",
        "description": "Declines a proposed purchase order match for a bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
                  },
                  "vendorId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "purchaseOrderLineId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "basis": {
                    "type": "string",
                    "enum": [
                      "DOCUMENT_NUMBER",
                      "SUPPLIER_ITEM",
                      "PRICE_AND_QUANTITY",
                      "MODEL"
                    ]
                  },
                  "orderReference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  }
                },
                "required": [
                  "entityId",
                  "vendorId",
                  "purchaseOrderLineId",
                  "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/DeclinePurchaseOrderSuggestionResponse"
                }
              }
            }
          },
          "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/bills/preview": {
      "post": {
        "operationId": "previewBill",
        "summary": "Previews how a bill will post before it is saved.",
        "description": "Previews how a bill will post before it is saved. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:read",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "vendorId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "supplierName": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "supplierRegistrationNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{9}RT\\d{4}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "number": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "billDate": {
                    "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}$"
                  },
                  "memo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "deliveryRegion": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^(CA|US)-[A-Z]{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines3"
                  },
                  "billId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "entityId",
                  "billDate",
                  "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": {
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "functionalCurrency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "subtotalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "taxMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "totalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "dueDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "delivery": {
                      "type": "object",
                      "properties": {
                        "region": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "why": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "region",
                        "why"
                      ],
                      "additionalProperties": false
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "position": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "netMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "taxMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "recoverableMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "treatment": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "placeOfSupply": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "taxName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "unresolved": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "overrideReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "position",
                          "netMinor",
                          "taxMinor",
                          "recoverableMinor",
                          "treatment",
                          "placeOfSupply",
                          "taxName",
                          "unresolved",
                          "overrideReason"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "taxComparison": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "chargedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "determinedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "agrees": {
                              "type": "boolean"
                            },
                            "applied": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "chargedMinor",
                            "determinedMinor",
                            "agrees",
                            "applied"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "fx": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "rate": {
                              "type": "string"
                            },
                            "rateDate": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "source": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "rate",
                            "rateDate",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "findings": {
                      "$ref": "#/components/schemas/Findings2"
                    },
                    "submittable": {
                      "type": "boolean"
                    },
                    "conversion": {
                      "$ref": "#/components/schemas/Conversion"
                    },
                    "holdback": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "grossMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "retainedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "dueNowSubtotalMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "creditNowMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "waitingNote": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "grossMinor",
                            "retainedMinor",
                            "dueNowSubtotalMinor",
                            "creditNowMinor",
                            "waitingNote"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "currency",
                    "functionalCurrency",
                    "subtotalMinor",
                    "taxMinor",
                    "totalMinor",
                    "dueDate",
                    "delivery",
                    "lines",
                    "taxComparison",
                    "fx",
                    "findings",
                    "submittable",
                    "conversion",
                    "holdback"
                  ],
                  "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/bills/service-period-proposals": {
      "post": {
        "operationId": "proposeBillServicePeriods",
        "summary": "Suggests the service period a bill covers and saves nothing.",
        "description": "Suggests the service period a bill covers and saves nothing. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
                  },
                  "billDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "lines": {
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 500
                        }
                      },
                      "required": [
                        "key",
                        "description"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "entityId",
                  "billDate",
                  "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": {
                    "proposals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "start": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "end": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "descriptionDigest": {
                            "type": "string",
                            "pattern": "^[0-9a-f]{64}$"
                          }
                        },
                        "required": [
                          "key",
                          "start",
                          "end",
                          "descriptionDigest"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "modelWhy": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "PROVIDER_UNAVAILABLE",
                            "TIMEOUT",
                            "REFUSED",
                            "UNPARSABLE",
                            "UNSANE",
                            "BUDGET",
                            "DISCLOSURE",
                            "STOPPED_AFTER_THREE_DECLINES",
                            "NO_LINES",
                            "HIDDEN_AFTER_DECLINE"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "hiddenAfterDecline": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "proposals",
                    "modelWhy",
                    "hiddenAfterDecline"
                  ],
                  "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/bills/service-period-proposals/outcome": {
      "post": {
        "operationId": "recordServicePeriodOutcome",
        "summary": "Records the outcome of a service period proposal.",
        "description": "Records the outcome of a service period proposal. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
                  },
                  "vendorId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "billId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "descriptionDigest": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "KEPT",
                      "DECLINED"
                    ]
                  },
                  "suggestedStart": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "suggestedEnd": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "keptStart": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "keptEnd": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "entityId",
                  "descriptionDigest",
                  "outcome",
                  "suggestedStart",
                  "suggestedEnd"
                ],
                "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": {
                    "recorded": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "recorded"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/bills/{billId}": {
      "get": {
        "operationId": "getBill",
        "summary": "Returns one bill with its lines, its status and its history.",
        "description": "Returns one bill with its lines, its status and its history. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "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/ListBillsResponseItem"
                }
              }
            }
          },
          "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": "updateBill",
        "summary": "Changes a draft bill.",
        "description": "Changes a draft bill. Needs the `ledger:propose` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "vendorId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "supplierName": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "supplierRegistrationNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{9}RT\\d{4}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "number": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "billDate": {
                    "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}$"
                  },
                  "memo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "deliveryRegion": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^(CA|US)-[A-Z]{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines3"
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields4"
                  },
                  "submit": {
                    "default": false,
                    "type": "boolean"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "billDate",
                  "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"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordBillFxRateResponse"
                }
              }
            }
          },
          "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/bills/{billId}/budget-position": {
      "get": {
        "operationId": "getBillBudgetPosition",
        "summary": "Returns the budget position a bill draws on.",
        "description": "Returns the budget position a bill draws on. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "billId",
            "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/GetPurchaseOrderBudgetPositionResponse"
                }
              }
            }
          },
          "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/bills/{billId}/capital": {
      "get": {
        "operationId": "getBillCapital",
        "summary": "Returns the capital position of a bill.",
        "description": "Returns the capital position of a bill. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "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/LineOption1"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "billId": {
                      "type": "string"
                    },
                    "billStatus": {
                      "type": "string"
                    },
                    "billNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "functionalCurrency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "country": {
                      "type": "string",
                      "minLength": 2,
                      "maxLength": 2
                    },
                    "floorMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "readOn": {
                      "type": "boolean"
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "flagged": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "registered": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "other": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "flagged",
                        "registered",
                        "other"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "billId",
                    "billStatus",
                    "billNumber",
                    "entityId",
                    "entityName",
                    "entityTimeZone",
                    "functionalCurrency",
                    "country",
                    "floorMinor",
                    "readOn",
                    "counts"
                  ],
                  "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/bills/{billId}/capital/assets": {
      "post": {
        "operationId": "registerBillAsset",
        "summary": "Registers a capital asset from a bill.",
        "description": "Registers a capital asset from a bill. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "billLineId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "basisDigest": {
                    "type": "string",
                    "minLength": 32,
                    "maxLength": 32
                  },
                  "asset": {
                    "$ref": "#/components/schemas/RegisterAssetRequest"
                  },
                  "readingId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "costNote": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 300
                  }
                },
                "required": [
                  "billLineId",
                  "basisDigest",
                  "asset"
                ],
                "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/RegisterBillAssetResponse"
                }
              }
            }
          },
          "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/bills/{billId}/capital/links": {
      "post": {
        "operationId": "linkBillAsset",
        "summary": "Links a bill to a capital asset.",
        "description": "Links a bill to a capital asset. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "billLineId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "basisDigest": {
                    "type": "string",
                    "minLength": 32,
                    "maxLength": 32
                  },
                  "assetId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "billLineId",
                  "basisDigest",
                  "assetId"
                ],
                "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/RegisterBillAssetResponse"
                }
              }
            }
          },
          "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/bills/{billId}/capital/readings": {
      "post": {
        "operationId": "readBillCapital",
        "summary": "Asks for a bill's capital readings to be read again, and answers at once; the reading follows.",
        "description": "Asks for a bill's capital readings to be read again, and answers at once; the reading follows. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "signalId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "signalId"
                ],
                "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": {
                    "signalId": {
                      "type": "string"
                    },
                    "attempt": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 3
                    }
                  },
                  "required": [
                    "signalId",
                    "attempt"
                  ],
                  "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/bills/{billId}/correction-prefill": {
      "get": {
        "operationId": "getBillCorrectionPrefill",
        "summary": "Returns the values a correction to a bill starts from.",
        "description": "Returns the values a correction to a bill starts from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "flagProposalId",
            "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": {
                    "replaces": {
                      "type": "object",
                      "properties": {
                        "billId": {
                          "type": "string"
                        },
                        "supplierName": {
                          "type": "string"
                        },
                        "number": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "billDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "DRAFT",
                            "IN_REVIEW",
                            "DECLINED",
                            "APPROVED",
                            "HELD",
                            "OPEN",
                            "DUE",
                            "OVERDUE",
                            "IN_RUN",
                            "PARTIALLY_PAID",
                            "PAID",
                            "VOID"
                          ]
                        },
                        "totalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "voidedAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 20
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "voidReason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "billId",
                        "supplierName",
                        "number",
                        "billDate",
                        "status",
                        "totalMinor",
                        "currency",
                        "voidedAt",
                        "voidReason"
                      ],
                      "additionalProperties": false
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "flag": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "proposalId": {
                              "type": "string"
                            },
                            "documentId": {
                              "type": "string"
                            },
                            "fileName": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "proposalId",
                            "documentId",
                            "fileName"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "header": {
                      "type": "object",
                      "properties": {
                        "vendorId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "supplierName": {
                          "type": "string"
                        },
                        "number": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "billDate": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "payableAccountId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "deliveryRegion": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^(CA|US)-[A-Z]{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "documentId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "vendorId",
                        "supplierName",
                        "number",
                        "billDate",
                        "currency",
                        "payableAccountId",
                        "deliveryRegion",
                        "documentId"
                      ],
                      "additionalProperties": false
                    },
                    "lines": {
                      "minItems": 1,
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "description": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500
                          },
                          "accountId": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "quantity": {
                            "default": "1",
                            "type": "string",
                            "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                          },
                          "unitPriceMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "netMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "taxAsPrintedMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "supplyCategory": {
                            "type": "string",
                            "enum": [
                              "GOODS",
                              "SERVICES",
                              "INTANGIBLE_PROPERTY",
                              "REAL_PROPERTY"
                            ]
                          },
                          "itcKind": {
                            "type": "string",
                            "enum": [
                              "GENERAL",
                              "MEALS_ENTERTAINMENT",
                              "PASSENGER_VEHICLE",
                              "ZERO_EMISSION_VEHICLE",
                              "EXEMPT_ACTIVITY",
                              "NONE"
                            ]
                          },
                          "dimensions": {
                            "$ref": "#/components/schemas/Dimensions2"
                          },
                          "servicePeriodStart": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "servicePeriodEnd": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "purchaseOrderLineId": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "customFields": {
                            "$ref": "#/components/schemas/CustomFields5"
                          },
                          "codedFrom": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "SAME_POSITION",
                                  "SAME_DESCRIPTION",
                                  "FIRST_BILL"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "description",
                          "quantity",
                          "supplyCategory",
                          "itcKind",
                          "codedFrom"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "documentTotalMinor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "differences": {
                      "$ref": "#/components/schemas/Differences"
                    }
                  },
                  "required": [
                    "replaces",
                    "entityId",
                    "flag",
                    "header",
                    "lines",
                    "documentTotalMinor",
                    "differences"
                  ],
                  "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/bills/{billId}/decide": {
      "post": {
        "operationId": "decideBill",
        "summary": "Approves, declines or sends a submitted bill back.",
        "description": "Approves, declines or sends a submitted bill back. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "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",
                    "maxLength": 500
                  },
                  "paidBy": {
                    "type": "string",
                    "enum": [
                      "RUN",
                      "CARD",
                      "PAD",
                      "CHEQUE",
                      "WIRE",
                      "ETRANSFER",
                      "OTHER"
                    ]
                  },
                  "postingDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "budgetVerdict": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{16}$"
                  },
                  "alsoRecord": {
                    "type": "object",
                    "properties": {
                      "sourceTransactionId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "feedScoreBp": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000
                      }
                    },
                    "required": [
                      "sourceTransactionId",
                      "feedScoreBp"
                    ],
                    "additionalProperties": false
                  },
                  "seenTotalMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "matchVerdict": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{16}$"
                  },
                  "prepaid": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "position": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "choice": {
                          "type": "string",
                          "enum": [
                            "SCHEDULE",
                            "EXPENSE"
                          ]
                        },
                        "method": {
                          "type": "string",
                          "enum": [
                            "BY_MONTH",
                            "BY_DAY"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "maxLength": 300
                        }
                      },
                      "required": [
                        "position",
                        "choice"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "prepaidDigest": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{16}$"
                  }
                },
                "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": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "DRAFT",
                        "IN_REVIEW",
                        "APPROVED",
                        "PARTIALLY_PAID",
                        "PAID",
                        "VOID"
                      ]
                    },
                    "versionCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "findings": {
                      "$ref": "#/components/schemas/Findings2"
                    },
                    "alsoRecorded": {
                      "default": null,
                      "anyOf": [
                        {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "const": "POSTED"
                                },
                                "settlementId": {
                                  "type": "string"
                                },
                                "entryId": {
                                  "type": "string"
                                },
                                "sentence": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "state",
                                "settlementId",
                                "entryId",
                                "sentence"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "const": "WAITING"
                                },
                                "settlementId": {
                                  "type": "string"
                                },
                                "sentence": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "state",
                                "settlementId",
                                "sentence"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "const": "NOT_RECORDED"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "sentence": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "state",
                                "code",
                                "sentence"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "versionCount",
                    "findings",
                    "alsoRecorded"
                  ],
                  "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/bills/{billId}/desk/reassign": {
      "post": {
        "operationId": "reassignBillDesk",
        "summary": "Moves a bill to another approval desk.",
        "description": "Moves a bill to another approval desk. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "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": {
                  "type": "object",
                  "properties": {
                    "stageId": {
                      "type": "string"
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 6
                    },
                    "stageCount": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 6
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "REVIEW",
                        "SIGN"
                      ]
                    },
                    "desk": {
                      "$ref": "#/components/schemas/Desk"
                    },
                    "routedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "forSomeoneElse": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "approver": {
                      "$ref": "#/components/schemas/Desk"
                    },
                    "group": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "rule": {
                              "type": "string",
                              "enum": [
                                "ANY",
                                "ALL"
                              ]
                            },
                            "members": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "votes": {
                              "maxItems": 10,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "member": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "decidedBy": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "at": {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  "decision": {
                                    "type": "string",
                                    "enum": [
                                      "APPROVE",
                                      "DECLINE"
                                    ]
                                  }
                                },
                                "required": [
                                  "member",
                                  "decidedBy",
                                  "at",
                                  "decision"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "rule",
                            "members",
                            "votes"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "workflow": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "version": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "id",
                            "name",
                            "version"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "escalation": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "afterDays": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 60
                            },
                            "to": {
                              "oneOf": [
                                {
                                  "$ref": "#/components/schemas/DeskOption1"
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "AUTHORITY"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "afterDays",
                            "to"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "subject": {
                      "type": "string",
                      "enum": [
                        "BILL",
                        "BILL_EDIT"
                      ]
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "substitute": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "authorityRequiredMinor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "functionalCurrency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "holders": {
                      "type": "object",
                      "properties": {
                        "people": {
                          "maxItems": 5,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "total": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "people",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "rule": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "version": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "sourceText": {
                              "type": "string"
                            },
                            "author": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "expiresAt": {
                              "type": "string",
                              "minLength": 20
                            }
                          },
                          "required": [
                            "id",
                            "version",
                            "sourceText",
                            "author",
                            "expiresAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "reasonCode": {
                      "type": "string",
                      "enum": [
                        "RULE_DESK",
                        "RULE_REVIEW_THEN_SIGN",
                        "NO_RULE",
                        "NOBODY",
                        "NO_RATE",
                        "RULE_OVER_AUTHOR_CAP",
                        "DESK_PREPARED_IT",
                        "BACKFILLED",
                        "REASSIGNED",
                        "ESCALATED",
                        "SECOND_STAGE"
                      ]
                    },
                    "reason": {
                      "type": "string"
                    },
                    "routedBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "waitingDays": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "nudgedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "openedByEscalation": {
                      "type": "boolean"
                    },
                    "firstStage": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "decidedBy": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "decidedAt": {
                              "type": "string",
                              "minLength": 20
                            }
                          },
                          "required": [
                            "decidedBy",
                            "decidedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "stageId",
                    "position",
                    "stageCount",
                    "kind",
                    "desk",
                    "routedAt",
                    "forSomeoneElse",
                    "approver",
                    "group",
                    "workflow",
                    "escalation",
                    "subject",
                    "revision",
                    "substitute",
                    "authorityRequiredMinor",
                    "functionalCurrency",
                    "holders",
                    "rule",
                    "reasonCode",
                    "reason",
                    "routedBy",
                    "waitingDays",
                    "nudgedAt",
                    "openedByEscalation",
                    "firstStage"
                  ],
                  "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/bills/{billId}/discard": {
      "post": {
        "operationId": "discardBill",
        "summary": "Discards a draft bill that has not been submitted.",
        "description": "Discards a draft bill that has not been submitted. Needs the `ledger:propose` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "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/RecordBillFxRateResponse"
                }
              }
            }
          },
          "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/bills/{billId}/edit/decide": {
      "post": {
        "operationId": "decideBillEdit",
        "summary": "Accepts or declines a proposed edit to a bill.",
        "description": "Accepts or declines a proposed edit to a bill. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "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",
                    "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/RecordBillFxRateResponse"
                }
              }
            }
          },
          "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/bills/{billId}/editable": {
      "get": {
        "operationId": "getBillEditable",
        "summary": "Returns a bill in the form needed to edit it.",
        "description": "Returns a bill in the form needed to edit it. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "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"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "DRAFT",
                        "IN_REVIEW",
                        "APPROVED",
                        "PARTIALLY_PAID",
                        "PAID",
                        "VOID"
                      ]
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "INBOX_DOCUMENT",
                        "MANUAL",
                        "IMPORT",
                        "RECURRING"
                      ]
                    },
                    "vendorId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "supplierName": {
                      "type": "string"
                    },
                    "supplierRegistrationNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "billDate": {
                      "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}$"
                    },
                    "memo": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "payableAccountId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "deliveryRegion": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "supplierRegion": {
                      "default": null,
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paidBy": {
                      "type": "string",
                      "enum": [
                        "RUN",
                        "CARD",
                        "PAD",
                        "ACCOUNT",
                        "CHEQUE",
                        "WIRE",
                        "ETRANSFER",
                        "OTHER"
                      ]
                    },
                    "documentId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "document": {
                      "default": null,
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "fileName": {
                              "type": "string"
                            },
                            "mimeType": {
                              "type": "string"
                            },
                            "sizeBytes": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "id",
                            "fileName",
                            "mimeType",
                            "sizeBytes"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "subtotalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "taxMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "totalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "versionCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "lines": {
                      "$ref": "#/components/schemas/Lines4"
                    },
                    "customFields": {
                      "$ref": "#/components/schemas/CustomFields2"
                    },
                    "draftedBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "entryId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "proposal": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "BILL",
                                "BILL_EDIT",
                                "JOURNAL_ENTRY"
                              ]
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "PENDING",
                                "APPROVED",
                                "EDITED_APPROVED",
                                "REJECTED",
                                "EXPIRED",
                                "WITHDRAWN"
                              ]
                            },
                            "submittedBy": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "submittedAt": {
                              "type": "string",
                              "minLength": 20
                            },
                            "note": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "reviewedBy": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "name"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "reviewedAt": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 20
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "rejectReason": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "kind",
                            "status",
                            "submittedBy",
                            "submittedAt",
                            "note",
                            "reviewedBy",
                            "reviewedAt",
                            "rejectReason"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "pendingEdit": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "proposalId": {
                              "type": "string"
                            },
                            "proposedBy": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "proposedAt": {
                              "type": "string",
                              "minLength": 20
                            },
                            "reason": {
                              "type": "string"
                            },
                            "revision": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "before": {
                              "$ref": "#/components/schemas/Before"
                            },
                            "after": {
                              "$ref": "#/components/schemas/Before"
                            },
                            "lines": {
                              "$ref": "#/components/schemas/Lines4"
                            },
                            "findings": {
                              "$ref": "#/components/schemas/Findings2"
                            },
                            "postsOn": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "reversesOn": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            }
                          },
                          "required": [
                            "proposalId",
                            "proposedBy",
                            "proposedAt",
                            "reason",
                            "revision",
                            "before",
                            "after",
                            "lines",
                            "findings",
                            "postsOn",
                            "reversesOn"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "blocked": {
                      "type": "object",
                      "properties": {
                        "void": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "discard": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "proposeEdit": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "amountChange": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "void",
                        "discard",
                        "proposeEdit",
                        "amountChange"
                      ],
                      "additionalProperties": false
                    },
                    "approval": {
                      "type": "object",
                      "properties": {
                        "approvedUnder": {
                          "$ref": "#/components/schemas/ApprovedUnder"
                        }
                      },
                      "required": [
                        "approvedUnder"
                      ],
                      "additionalProperties": false
                    },
                    "desk": {
                      "$ref": "#/components/schemas/Desk2"
                    },
                    "hold": {
                      "default": null,
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "held": {
                              "default": true,
                              "type": "boolean",
                              "const": true
                            },
                            "since": {
                              "type": "string",
                              "minLength": 20
                            }
                          },
                          "required": [
                            "held",
                            "since"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "posting": {
                      "anyOf": [
                        {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "OPEN"
                                },
                                "billDate": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "postsOn": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                }
                              },
                              "required": [
                                "kind",
                                "billDate",
                                "postsOn"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "MOVED"
                                },
                                "billDate": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "postsOn": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "earliest": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "latest": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "closedBy": {
                                  "$ref": "#/components/schemas/ClosedBy"
                                }
                              },
                              "required": [
                                "kind",
                                "billDate",
                                "postsOn",
                                "earliest",
                                "latest",
                                "closedBy"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "NO_OPEN_PERIOD"
                                },
                                "billDate": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "billMonth": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}$"
                                },
                                "thisMonth": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}$"
                                },
                                "closedBy": {
                                  "$ref": "#/components/schemas/ClosedBy"
                                }
                              },
                              "required": [
                                "kind",
                                "billDate",
                                "billMonth",
                                "thisMonth",
                                "closedBy"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "entityId",
                    "status",
                    "source",
                    "vendorId",
                    "supplierName",
                    "supplierRegistrationNumber",
                    "number",
                    "billDate",
                    "dueDate",
                    "currency",
                    "memo",
                    "payableAccountId",
                    "deliveryRegion",
                    "supplierRegion",
                    "paidBy",
                    "documentId",
                    "document",
                    "subtotalMinor",
                    "taxMinor",
                    "totalMinor",
                    "versionCount",
                    "lines",
                    "draftedBy",
                    "entryId",
                    "proposal",
                    "pendingEdit",
                    "blocked",
                    "approval",
                    "desk",
                    "hold",
                    "posting"
                  ],
                  "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/bills/{billId}/feed-candidates": {
      "get": {
        "operationId": "listBillFeedCandidates",
        "summary": "Lists the bank feed lines a bill may settle.",
        "description": "Lists the bank feed lines a bill may settle. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "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/ListBillFeedCandidatesResponse"
                }
              }
            }
          },
          "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/bills/{billId}/feed-candidates/{sourceTransactionId}/decline": {
      "post": {
        "operationId": "declineBillFeedLine",
        "summary": "Declines a bank feed line as the settlement of a bill.",
        "description": "Declines a bank feed line as the settlement of a bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceTransactionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "enum": [
                      "NOT_THIS_SUPPLIER",
                      "NOT_THIS_BILL",
                      "NOT_A_PAYMENT",
                      "OTHER"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "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/ListBillFeedCandidatesResponse"
                }
              }
            }
          },
          "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/bills/{billId}/feed-candidates/{sourceTransactionId}/descriptor": {
      "post": {
        "operationId": "readFeedDescriptor",
        "summary": "Reads the descriptor of a bank feed line a bill might settle.",
        "description": "Reads the descriptor of a bank feed line a bill might settle. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sourceTransactionId",
            "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": {
                    "reading": {
                      "$ref": "#/components/schemas/Reading"
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "PROVIDER",
                            "REFUSED",
                            "UNPARSABLE",
                            "QUOTE_NOT_IN_TEXT",
                            "BUDGET",
                            "DISCLOSURE"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "reading",
                    "why"
                  ],
                  "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/bills/{billId}/fx-rate": {
      "post": {
        "operationId": "recordBillFxRate",
        "summary": "Records the exchange rate a foreign currency bill was paid at.",
        "description": "Records the exchange rate a foreign currency bill was paid at. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "from": {
                        "type": "string",
                        "const": "METHOD"
                      },
                      "note": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      }
                    },
                    "required": [
                      "from",
                      "note"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "from": {
                        "type": "string",
                        "const": "TYPED"
                      },
                      "fxRate": {
                        "type": "string",
                        "pattern": "^\\d{1,6}(\\.\\d{1,6})?$"
                      },
                      "fxRateDate": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "note": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      }
                    },
                    "required": [
                      "from",
                      "fxRate",
                      "fxRateDate",
                      "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/RecordBillFxRateResponse"
                }
              }
            }
          },
          "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/bills/{billId}/hold": {
      "post": {
        "operationId": "holdBill",
        "summary": "Puts a bill on hold so it is not paid.",
        "description": "Puts a bill on hold so it is not paid. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "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
                  },
                  "until": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "reasonSource": {
                    "default": "PERSON",
                    "type": "string",
                    "enum": [
                      "PERSON",
                      "AGENT_DRAFT",
                      "AGENT_DRAFT_EDITED"
                    ]
                  },
                  "draftPromptVersion": {
                    "type": "string",
                    "maxLength": 40
                  }
                },
                "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/HoldBillResponse"
                }
              }
            }
          },
          "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/bills/{billId}/hold-brief": {
      "post": {
        "operationId": "draftBillHoldReason",
        "summary": "Drafts the reason for putting one bill on hold.",
        "description": "Drafts the reason for putting one bill on hold. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "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"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftVendorHoldReasonResponse"
                }
              }
            }
          },
          "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/bills/{billId}/hold/release": {
      "post": {
        "operationId": "releaseBillHold",
        "summary": "Releases a bill from hold so it can be paid.",
        "description": "Releases a bill from hold so it can be paid. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "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/HoldBillResponse"
                }
              }
            }
          },
          "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/bills/{billId}/holdback": {
      "get": {
        "operationId": "getBillHoldback",
        "summary": "Returns the holdback on a bill.",
        "description": "Returns the holdback on a bill. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "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/Holdback"
                }
              }
            }
          },
          "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/bills/{billId}/holdback/draft": {
      "post": {
        "operationId": "draftBillHoldback",
        "summary": "Drafts the holdback terms for a bill.",
        "description": "Drafts the holdback terms for a bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "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": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "drafted": {
                          "type": "object",
                          "properties": {
                            "form": {
                              "type": "string",
                              "enum": [
                                "PERCENT",
                                "STATED_NONE",
                                "MENTIONED"
                              ]
                            },
                            "percent": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "bp": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 5000
                                    },
                                    "quote": {
                                      "type": "string",
                                      "maxLength": 200
                                    }
                                  },
                                  "required": [
                                    "bp",
                                    "quote"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "authority": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "enum": [
                                        "STATUTE",
                                        "AGREEMENT"
                                      ]
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "quote": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 200
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "kind",
                                "quote"
                              ],
                              "additionalProperties": false
                            },
                            "timing": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "quote": {
                                      "type": "string",
                                      "maxLength": 200
                                    }
                                  },
                                  "required": [
                                    "quote"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "confidenceBp": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10000
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "form",
                            "percent",
                            "authority",
                            "timing",
                            "confidenceBp",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        "why": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "drafted",
                        "why"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "drafted": {
                          "type": "null"
                        },
                        "why": {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNPARSABLE",
                            "REFUSED",
                            "NO_DOCUMENT",
                            "NOTHING_STATED",
                            "STOPPED_AFTER_THREE_OVERRIDES",
                            "TRUNCATED",
                            "UNSAFE_ANSWER",
                            "DECLINED_BEFORE",
                            "NOT_A_DRAFT"
                          ]
                        }
                      },
                      "required": [
                        "drafted",
                        "why"
                      ],
                      "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/bills/{billId}/holdback/none": {
      "post": {
        "operationId": "markBillHoldbackNone",
        "summary": "Records that a bill has no holdback.",
        "description": "Records that a bill has no holdback. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 200
                  }
                },
                "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": {
                  "type": "object",
                  "properties": {
                    "billId": {
                      "type": "string"
                    },
                    "holdback": {
                      "$ref": "#/components/schemas/Holdback"
                    }
                  },
                  "required": [
                    "billId",
                    "holdback"
                  ],
                  "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/bills/{billId}/holdback/release": {
      "post": {
        "operationId": "prepareBillHoldbackRelease",
        "summary": "Prepares the release of a bill's holdback.",
        "description": "Prepares the release of a bill's holdback. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "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+$"
                  },
                  "releasedOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "submit": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "releasedOn"
                ],
                "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": {
                    "releaseBillId": {
                      "type": "string"
                    },
                    "holdback": {
                      "$ref": "#/components/schemas/Holdback"
                    }
                  },
                  "required": [
                    "releaseBillId",
                    "holdback"
                  ],
                  "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/bills/{billId}/itc-evidence": {
      "post": {
        "operationId": "stateBillItcEvidence",
        "summary": "Records the evidence that supports the input tax credit on a bill.",
        "description": "Records the evidence that supports the input tax credit on a bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recipientShown": {
                    "type": "boolean"
                  },
                  "recipientAsPrinted": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "termsShown": {
                    "type": "boolean"
                  },
                  "termsAsPrinted": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "descriptionsShown": {
                    "type": "boolean"
                  },
                  "registrationSeen": {
                    "type": "string",
                    "pattern": "^\\d{9}RT\\d{4}$"
                  },
                  "heldElsewhere": {
                    "default": false,
                    "type": "boolean"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "afterStatementId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "source": {
                    "default": "PERSON",
                    "type": "string",
                    "enum": [
                      "PERSON",
                      "AGENT_DRAFT",
                      "AGENT_DRAFT_EDITED"
                    ]
                  },
                  "draftPromptVersion": {
                    "type": "string",
                    "maxLength": 40
                  }
                },
                "required": [
                  "recipientShown",
                  "termsShown",
                  "afterStatementId"
                ],
                "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": {
                    "result": {
                      "type": "string",
                      "enum": [
                        "NOT_CLAIMED",
                        "PASSES",
                        "FAILS",
                        "UNTESTED"
                      ]
                    },
                    "basis": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DOCUMENT",
                            "READING_MODEL",
                            "STATEMENT"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "claimedMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "functionalTotalMinor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "functionalCurrency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "tier": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "UNDER_LOWER",
                            "LOWER",
                            "UPPER"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "schedule": {
                      "type": "object",
                      "properties": {
                        "effectiveFrom": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "lowerMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "upperMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "source": {
                          "type": "string"
                        },
                        "amendedBy": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "READ",
                            "AWAITING_CPA"
                          ]
                        }
                      },
                      "required": [
                        "effectiveFrom",
                        "lowerMinor",
                        "upperMinor",
                        "source",
                        "amendedBy",
                        "status"
                      ],
                      "additionalProperties": false
                    },
                    "elements": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "element": {
                            "type": "string",
                            "enum": [
                              "DOCUMENT",
                              "SUPPLIER_NAME",
                              "DATE",
                              "TOTAL",
                              "REGISTRATION",
                              "TAX_SHOWN",
                              "RECIPIENT",
                              "TERMS",
                              "DESCRIPTIONS"
                            ]
                          },
                          "requiredFrom": {
                            "type": "string",
                            "enum": [
                              "ALWAYS",
                              "LOWER",
                              "UPPER"
                            ]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "SHOWN",
                              "MISSING",
                              "OTHER_NAME",
                              "NOT_READ",
                              "NOT_REQUIRED"
                            ]
                          },
                          "basis": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "BILL",
                                  "RULE",
                                  "MODEL",
                                  "PERSON"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "asPrinted": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "element",
                          "requiredFrom",
                          "state",
                          "basis",
                          "asPrinted"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "untestedReason": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "NO_FUNCTIONAL_TOTAL",
                            "ELEMENTS_NOT_READ"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "statement": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "by": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "at": {
                              "type": "string",
                              "minLength": 20
                            },
                            "heldElsewhere": {
                              "type": "boolean"
                            },
                            "note": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "draftSource": {
                              "type": "string",
                              "enum": [
                                "PERSON",
                                "AGENT_DRAFT",
                                "AGENT_DRAFT_EDITED"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "by",
                            "at",
                            "heldElsewhere",
                            "note",
                            "draftSource"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "reading": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "at": {
                              "type": "string",
                              "minLength": 20
                            },
                            "recipientReadBy": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "RULE",
                                    "MODEL"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "termsReadBy": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "RULE",
                                    "MODEL"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "notReadReason": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "BELOW_UPPER",
                                    "NOT_CLAIMED",
                                    "DISCLOSURE",
                                    "BUDGET",
                                    "PROVIDER",
                                    "REFUSED",
                                    "TRUNCATED",
                                    "UNPARSABLE",
                                    "QUOTE_NOT_IN_TEXT",
                                    "INSTRUCTION_IN_QUOTE",
                                    "RUN_TIME",
                                    "NOTHING_FOUND"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "promptVersion": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "at",
                            "recipientReadBy",
                            "termsReadBy",
                            "notReadReason",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "window": {
                      "$ref": "#/components/schemas/Window2"
                    },
                    "windowUnavailable": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "NO_REGISTRATION",
                            "NOT_CLAIMED"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mayState": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "result",
                    "basis",
                    "claimedMinor",
                    "currency",
                    "functionalTotalMinor",
                    "functionalCurrency",
                    "tier",
                    "schedule",
                    "elements",
                    "untestedReason",
                    "statement",
                    "reading",
                    "window",
                    "windowUnavailable",
                    "mayState"
                  ],
                  "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/bills/{billId}/itc-evidence/draft": {
      "post": {
        "operationId": "draftBillItcEvidence",
        "summary": "Drafts the evidence that supports the input tax credit on a bill.",
        "description": "Drafts the evidence that supports the input tax credit on a bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "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"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "drafted": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "recipientShown": {
                              "type": "boolean"
                            },
                            "recipientAsPrinted": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "termsShown": {
                              "type": "boolean"
                            },
                            "termsAsPrinted": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "recipientReadBy": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "RULE",
                                    "MODEL"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "termsReadBy": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "RULE",
                                    "MODEL"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "recipientShown",
                            "recipientAsPrinted",
                            "termsShown",
                            "termsAsPrinted",
                            "recipientReadBy",
                            "termsReadBy"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "NO_DOCUMENT",
                            "NOT_CLAIMED",
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNREADABLE",
                            "UNPARSABLE",
                            "REFUSED",
                            "TRUNCATED",
                            "QUOTE_NOT_IN_TEXT",
                            "INSTRUCTION_IN_QUOTE",
                            "NOTHING_FOUND"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "promptVersion": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "drafted",
                    "why",
                    "promptVersion"
                  ],
                  "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/bills/{billId}/lines": {
      "get": {
        "operationId": "listBillLines",
        "summary": "Lists the lines of a bill.",
        "description": "Lists the lines of a bill. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "revision",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000
            }
          },
          {
            "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",
                              "null"
                            ]
                          },
                          "position": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "description": {
                            "type": "string"
                          },
                          "account": {
                            "$ref": "#/components/schemas/Account"
                          },
                          "quantity": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "unitPriceMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "taxAsPrintedMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "supplyCategory": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "GOODS",
                                  "SERVICES",
                                  "INTANGIBLE_PROPERTY",
                                  "REAL_PROPERTY"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "taxAmountMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "taxProvincialAmountMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "dimensions": {
                            "$ref": "#/components/schemas/Dimensions"
                          },
                          "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"
                              }
                            ]
                          },
                          "purchaseOrderLine": {
                            "$ref": "#/components/schemas/PurchaseOrderLine"
                          },
                          "customFields": {
                            "description": "The line's own fields, by the field's key.",
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": [
                                "string",
                                "boolean"
                              ]
                            },
                            "x-stability-level": "beta"
                          },
                          "carriedFrom": {
                            "$ref": "#/components/schemas/CarriedFrom"
                          }
                        },
                        "required": [
                          "id",
                          "position",
                          "description",
                          "account",
                          "quantity",
                          "unitPriceMinor",
                          "amountMinor",
                          "taxAsPrintedMinor",
                          "supplyCategory",
                          "taxAmountMinor",
                          "taxProvincialAmountMinor",
                          "dimensions",
                          "servicePeriodStart",
                          "servicePeriodEnd",
                          "purchaseOrderLine"
                        ],
                        "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/bills/{billId}/match": {
      "get": {
        "operationId": "getBillMatch",
        "summary": "Returns how a bill matches the purchase orders and receipts it refers to.",
        "description": "Returns how a bill matches the purchase orders and receipts it refers to. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "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/GetBillMatchResponse"
                }
              }
            }
          },
          "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/bills/{billId}/order-links": {
      "post": {
        "operationId": "setBillOrderLinks",
        "summary": "Sets the purchase order lines a bill is matched to.",
        "description": "Sets the purchase order lines a bill is matched to. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "links": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "position": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "purchaseOrderLineId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "proposedOrder": {
                          "type": "object",
                          "properties": {
                            "basis": {
                              "type": "string",
                              "enum": [
                                "DOCUMENT_NUMBER",
                                "SUPPLIER_ITEM",
                                "PRICE_AND_QUANTITY",
                                "MODEL"
                              ]
                            },
                            "orderReference": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 80
                            }
                          },
                          "required": [
                            "basis"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "position",
                        "purchaseOrderLineId"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "links"
                ],
                "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/GetBillMatchResponse"
                }
              }
            }
          },
          "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/bills/{billId}/plan": {
      "post": {
        "operationId": "planBill",
        "summary": "Sets the payment plan of a bill.",
        "description": "Sets the payment plan of a bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "on": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "on"
                ],
                "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/PlanBillResponse"
                }
              }
            }
          },
          "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/bills/{billId}/plan/clear": {
      "post": {
        "operationId": "clearBillPlan",
        "summary": "Clears the payment plan of a bill.",
        "description": "Clears the payment plan of a bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "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/PlanBillResponse"
                }
              }
            }
          },
          "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/bills/{billId}/prepaid-plan": {
      "get": {
        "operationId": "getBillPrepaidPlan",
        "summary": "Returns the prepaid plan a bill is spread over.",
        "description": "Returns the prepaid plan a bill is spread over. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "billId",
            "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": {
                    "billId": {
                      "type": "string"
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "measuredOn": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "postingMoved": {
                      "type": "boolean"
                    },
                    "floorMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "planned": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "position": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "lineNumber": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "description": {
                            "type": "string"
                          },
                          "prepaidAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "releaseAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "servicePeriodStart": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "servicePeriodEnd": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "monthCount": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 60
                          },
                          "method": {
                            "type": "string",
                            "enum": [
                              "BY_MONTH",
                              "BY_DAY"
                            ]
                          },
                          "foldedMonths": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "estimatedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "rows": {
                            "maxItems": 60,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "position": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "periodStart": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "amountMinor": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                "foldedMonths": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "position",
                                "periodStart",
                                "amountMinor",
                                "foldedMonths"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          }
                        },
                        "required": [
                          "position",
                          "lineNumber",
                          "description",
                          "prepaidAccount",
                          "releaseAccount",
                          "servicePeriodStart",
                          "servicePeriodEnd",
                          "monthCount",
                          "method",
                          "foldedMonths",
                          "estimatedMinor",
                          "rows",
                          "currency"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "notPlanned": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "position": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "lineNumber": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "reason": {
                            "type": "string",
                            "enum": [
                              "NO_PERIOD",
                              "NOT_EXPENSE",
                              "PERIOD_ENDS_BY_POSTING",
                              "PERIOD_BEFORE_POSTING",
                              "NO_PREPAID_ACCOUNT",
                              "NO_RATE",
                              "TOO_LONG",
                              "BELOW_FLOOR",
                              "TOO_SMALL",
                              "LINE_UNCODED"
                            ]
                          }
                        },
                        "required": [
                          "position",
                          "lineNumber",
                          "reason"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "digest": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[0-9a-f]{16}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "readAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "billId",
                    "entityId",
                    "entityName",
                    "entityTimeZone",
                    "currency",
                    "measuredOn",
                    "postingMoved",
                    "floorMinor",
                    "planned",
                    "notPlanned",
                    "digest",
                    "readAt"
                  ],
                  "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/bills/{billId}/prepaid-schedules": {
      "get": {
        "operationId": "listBillPrepaidSchedules",
        "summary": "Lists the prepaid schedules a bill creates.",
        "description": "Lists the prepaid schedules a bill creates. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          },
          {
            "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": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "billId": {
                            "type": "string"
                          },
                          "linePosition": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "lineNumber": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "description": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "ACTIVE",
                              "COMPLETE",
                              "DECLINED",
                              "VOID"
                            ]
                          },
                          "method": {
                            "type": "string",
                            "enum": [
                              "BY_MONTH",
                              "BY_DAY"
                            ]
                          },
                          "periodStart": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "periodEnd": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "prepaidAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "releaseAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "totalMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "releasedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "remainingMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "monthsReleased": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "monthCount": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "decidedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "decidedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "declineReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "endedEarlyAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "completedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "restoredByScheduleId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "rows": {
                            "maxItems": 60,
                            "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+$"
                                },
                                "foldedMonths": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "SCHEDULED",
                                    "PROPOSED",
                                    "POSTED",
                                    "VOID"
                                  ]
                                },
                                "endedEarly": {
                                  "type": "boolean"
                                },
                                "entryId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "entryNumber": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "proposalId": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "effectiveState": {
                                  "type": "string",
                                  "enum": [
                                    "SCHEDULED",
                                    "PROPOSED",
                                    "POSTED",
                                    "VOID"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "position",
                                "periodStart",
                                "amountMinor",
                                "foldedMonths",
                                "status",
                                "endedEarly",
                                "entryId",
                                "entryNumber",
                                "proposalId",
                                "effectiveState"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "identityOk": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "billId",
                          "linePosition",
                          "lineNumber",
                          "description",
                          "status",
                          "method",
                          "periodStart",
                          "periodEnd",
                          "prepaidAccount",
                          "releaseAccount",
                          "totalMinor",
                          "releasedMinor",
                          "remainingMinor",
                          "monthsReleased",
                          "monthCount",
                          "decidedBy",
                          "decidedAt",
                          "declineReason",
                          "endedEarlyAt",
                          "completedAt",
                          "rows",
                          "identityOk"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "total",
                    "nextCursor"
                  ],
                  "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/bills/{billId}/question-brief": {
      "post": {
        "operationId": "draftBillQuestion",
        "summary": "Drafts a question about a bill for a person to send to the vendor.",
        "description": "Drafts a question about a bill for a person to send to the vendor. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "topic": {
                    "type": "string",
                    "enum": [
                      "AMOUNT",
                      "SUPPLIER",
                      "CODING",
                      "TAX",
                      "DUPLICATE"
                    ]
                  }
                },
                "required": [
                  "topic"
                ],
                "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": {
                    "drafted": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "why": {
                      "type": "string",
                      "enum": [
                        "DISCLOSURE",
                        "BUDGET",
                        "PROVIDER",
                        "UNPARSABLE",
                        "REFUSED",
                        "FIGURE_INVENTED",
                        "UNCITED",
                        "NO_FACTS",
                        "STOPPED_AFTER_THREE_DISCARDS"
                      ]
                    },
                    "promptVersion": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "usedFacts": {
                      "$ref": "#/components/schemas/Facts"
                    }
                  },
                  "required": [
                    "drafted",
                    "promptVersion",
                    "usedFacts"
                  ],
                  "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/bills/{billId}/question-facts": {
      "get": {
        "operationId": "getBillQuestionFacts",
        "summary": "Returns the facts a question about a bill is built from.",
        "description": "Returns the facts a question about a bill is built from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "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": {
                    "billId": {
                      "type": "string"
                    },
                    "billName": {
                      "type": "string"
                    },
                    "promptVersion": {
                      "type": "string"
                    },
                    "topics": {
                      "minItems": 6,
                      "maxItems": 6,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "topic": {
                            "type": "string",
                            "enum": [
                              "AMOUNT",
                              "SUPPLIER",
                              "CODING",
                              "TAX",
                              "DUPLICATE",
                              "OTHER"
                            ]
                          },
                          "facts": {
                            "$ref": "#/components/schemas/Facts"
                          },
                          "starter": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "open": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "questionId": {
                                    "type": "string"
                                  },
                                  "askedBy": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "askedOf": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "name"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "askedAt": {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "OPEN",
                                      "ANSWERED"
                                    ]
                                  }
                                },
                                "required": [
                                  "questionId",
                                  "askedBy",
                                  "askedOf",
                                  "askedAt",
                                  "status"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "draft": {
                            "type": "object",
                            "properties": {
                              "offered": {
                                "type": "boolean"
                              },
                              "why": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "DISCLOSURE",
                                      "BUDGET",
                                      "PROVIDER",
                                      "UNPARSABLE",
                                      "REFUSED",
                                      "FIGURE_INVENTED",
                                      "UNCITED",
                                      "NO_FACTS",
                                      "STOPPED_AFTER_THREE_DISCARDS"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "offered",
                              "why"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "topic",
                          "facts",
                          "starter",
                          "open",
                          "draft"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "facts": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "topic": {
                                "type": "string",
                                "enum": [
                                  "AMOUNT",
                                  "SUPPLIER",
                                  "CODING",
                                  "TAX",
                                  "DUPLICATE",
                                  "OTHER"
                                ]
                              },
                              "sources": {
                                "$ref": "#/components/schemas/Sources"
                              },
                              "kind": {
                                "type": "string",
                                "const": "AMOUNT_ABOVE_RECENT"
                              },
                              "totalMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "priorCount": {
                                "type": "integer",
                                "minimum": 2,
                                "maximum": 3
                              },
                              "largestPriorMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "aboveByMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              }
                            },
                            "required": [
                              "topic",
                              "sources",
                              "kind",
                              "totalMinor",
                              "currency",
                              "priorCount",
                              "largestPriorMinor",
                              "aboveByMinor"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "topic": {
                                "type": "string",
                                "enum": [
                                  "AMOUNT",
                                  "SUPPLIER",
                                  "CODING",
                                  "TAX",
                                  "DUPLICATE",
                                  "OTHER"
                                ]
                              },
                              "sources": {
                                "$ref": "#/components/schemas/Sources"
                              },
                              "kind": {
                                "type": "string",
                                "const": "FIRST_FROM_SUPPLIER"
                              }
                            },
                            "required": [
                              "topic",
                              "sources",
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "topic": {
                                "type": "string",
                                "enum": [
                                  "AMOUNT",
                                  "SUPPLIER",
                                  "CODING",
                                  "TAX",
                                  "DUPLICATE",
                                  "OTHER"
                                ]
                              },
                              "sources": {
                                "$ref": "#/components/schemas/Sources"
                              },
                              "kind": {
                                "type": "string",
                                "const": "SUPPLIER_NOT_ON_LIST"
                              }
                            },
                            "required": [
                              "topic",
                              "sources",
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "topic": {
                                "type": "string",
                                "enum": [
                                  "AMOUNT",
                                  "SUPPLIER",
                                  "CODING",
                                  "TAX",
                                  "DUPLICATE",
                                  "OTHER"
                                ]
                              },
                              "sources": {
                                "$ref": "#/components/schemas/Sources"
                              },
                              "kind": {
                                "type": "string",
                                "const": "SENDER_OR_BANKING_CHECK_OPEN"
                              },
                              "signalKinds": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "topic",
                              "sources",
                              "kind",
                              "signalKinds"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "topic": {
                                "type": "string",
                                "enum": [
                                  "AMOUNT",
                                  "SUPPLIER",
                                  "CODING",
                                  "TAX",
                                  "DUPLICATE",
                                  "OTHER"
                                ]
                              },
                              "sources": {
                                "$ref": "#/components/schemas/Sources"
                              },
                              "kind": {
                                "type": "string",
                                "const": "ACCOUNT_NEW_FOR_SUPPLIER"
                              },
                              "accounts": {
                                "maxItems": 3,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "code": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "code",
                                    "name"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "moreAccounts": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "topic",
                              "sources",
                              "kind",
                              "accounts",
                              "moreAccounts"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "topic": {
                                "type": "string",
                                "enum": [
                                  "AMOUNT",
                                  "SUPPLIER",
                                  "CODING",
                                  "TAX",
                                  "DUPLICATE",
                                  "OTHER"
                                ]
                              },
                              "sources": {
                                "$ref": "#/components/schemas/Sources"
                              },
                              "kind": {
                                "type": "string",
                                "const": "TAX_DIFFERS_FROM_PAPER"
                              },
                              "findingCodes": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "topic",
                              "sources",
                              "kind",
                              "findingCodes"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "topic": {
                                "type": "string",
                                "enum": [
                                  "AMOUNT",
                                  "SUPPLIER",
                                  "CODING",
                                  "TAX",
                                  "DUPLICATE",
                                  "OTHER"
                                ]
                              },
                              "sources": {
                                "$ref": "#/components/schemas/Sources"
                              },
                              "kind": {
                                "type": "string",
                                "const": "LOOKS_LIKE_A_DUPLICATE"
                              }
                            },
                            "required": [
                              "topic",
                              "sources",
                              "kind"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "defaultTopic": {
                      "type": "string",
                      "enum": [
                        "AMOUNT",
                        "SUPPLIER",
                        "CODING",
                        "TAX",
                        "DUPLICATE",
                        "OTHER"
                      ]
                    }
                  },
                  "required": [
                    "billId",
                    "billName",
                    "promptVersion",
                    "topics",
                    "facts",
                    "defaultTopic"
                  ],
                  "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/bills/{billId}/questions": {
      "get": {
        "operationId": "listBillQuestions",
        "summary": "Lists the questions asked about a bill.",
        "description": "Lists the questions asked about a bill. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "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/ListQuestionsResponse"
                }
              }
            }
          },
          "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/bills/{billId}/reading-record": {
      "get": {
        "operationId": "getBillReadingRecord",
        "summary": "Returns the record of how a bill was read from its document.",
        "description": "Returns the record of how a bill was read from its document. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "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": {
                    "billId": {
                      "type": "string"
                    },
                    "documentId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "extraction": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "readerId": {
                              "type": "string"
                            },
                            "readerLocation": {
                              "type": "string"
                            },
                            "pageCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "model": {
                              "type": "string"
                            },
                            "promptName": {
                              "type": "string"
                            },
                            "promptVersion": {
                              "type": "string"
                            },
                            "at": {
                              "type": "string",
                              "minLength": 20
                            }
                          },
                          "required": [
                            "readerId",
                            "readerLocation",
                            "pageCount",
                            "model",
                            "promptName",
                            "promptVersion",
                            "at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "calls": {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "at": {
                                "type": "string",
                                "minLength": 20
                              },
                              "feature": {
                                "type": "string"
                              },
                              "providerId": {
                                "type": "string"
                              },
                              "model": {
                                "type": "string"
                              },
                              "modelLocation": {
                                "type": "string"
                              },
                              "promptName": {
                                "type": "string"
                              },
                              "promptVersion": {
                                "type": "string"
                              },
                              "attempts": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 9007199254740991
                              },
                              "providerCalls": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "success": {
                                "type": "boolean"
                              },
                              "latencyMs": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "costMicroCad": {
                                "type": "string",
                                "pattern": "^\\d{1,18}$"
                              },
                              "withheld": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "at",
                              "feature",
                              "providerId",
                              "model",
                              "modelLocation",
                              "promptName",
                              "promptVersion",
                              "attempts",
                              "providerCalls",
                              "success",
                              "latencyMs",
                              "costMicroCad",
                              "withheld"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "data",
                        "nextCursor",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "faults": {
                      "maxItems": 50,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListAiProviderFaultsResponseItem"
                      }
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "billId",
                    "documentId",
                    "extraction",
                    "calls",
                    "faults",
                    "entityTimeZone"
                  ],
                  "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/bills/{billId}/settlement-hint": {
      "post": {
        "operationId": "readBillSettlementHint",
        "summary": "Reads the hint that suggests how a bill's payment settles.",
        "description": "Reads the hint that suggests how a bill's payment settles. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "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": {
                    "hint": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "method": {
                              "type": "string",
                              "enum": [
                                "CARD",
                                "PAD",
                                "CHEQUE",
                                "WIRE",
                                "ETRANSFER",
                                "OTHER",
                                "NOT_STATED"
                              ]
                            },
                            "settledOn": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "alreadyPaid": {
                              "type": "boolean"
                            },
                            "quote": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 300
                            },
                            "note": {
                              "type": "string",
                              "maxLength": 200
                            },
                            "lastFour": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "matchedAccount": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "displayName": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "displayName"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "priorMethods": {
                              "$ref": "#/components/schemas/PriorMethods"
                            },
                            "documentChars": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "readChars": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "method",
                            "settledOn",
                            "alreadyPaid",
                            "quote",
                            "note",
                            "lastFour",
                            "matchedAccount",
                            "priorMethods",
                            "documentChars",
                            "readChars",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "NO_DOCUMENT",
                            "NO_PAYMENT_WORDS",
                            "UNREADABLE",
                            "DISCLOSURE",
                            "BUDGET",
                            "REFUSED",
                            "UNPARSABLE",
                            "QUOTE_NOT_IN_TEXT",
                            "PROVIDER"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "hint",
                    "why"
                  ],
                  "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/bills/{billId}/settlements": {
      "get": {
        "operationId": "listBillSettlements",
        "summary": "Lists the settlements recorded against a bill.",
        "description": "Lists the settlements recorded against a bill. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "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": {
                        "$ref": "#/components/schemas/ListBillSettlementsResponseItem"
                      }
                    },
                    "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/bills/{billId}/settlements/{settlementId}/approve": {
      "post": {
        "operationId": "approveBillSettlement",
        "summary": "Approves a recorded settlement against a bill.",
        "description": "Approves a recorded settlement against a bill. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "settlementId",
            "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/ApproveBillSettlementResponse"
                }
              }
            }
          },
          "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/bills/{billId}/settlements/{settlementId}/void": {
      "post": {
        "operationId": "voidBillSettlement",
        "summary": "Voids a settlement recorded against a bill.",
        "description": "Voids a settlement recorded against a bill. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "settlementId",
            "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/ApproveBillSettlementResponse"
                }
              }
            }
          },
          "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/bills/{billId}/short-pay-brief": {
      "post": {
        "operationId": "draftShortPayReason",
        "summary": "Drafts the reason for a short payment on a bill.",
        "description": "Drafts the reason for a short payment on a bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "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"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "drafted": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "reason": {
                              "type": "string"
                            },
                            "language": {
                              "type": "string",
                              "enum": [
                                "en",
                                "fr"
                              ]
                            },
                            "gloss": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "reason",
                            "language",
                            "gloss",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "type": "string",
                      "enum": [
                        "DISCLOSURE",
                        "BUDGET",
                        "PROVIDER",
                        "UNPARSABLE",
                        "REFUSED",
                        "FIGURE_INVENTED",
                        "STOPPED_AFTER_THREE_REWRITES"
                      ]
                    }
                  },
                  "required": [
                    "drafted"
                  ],
                  "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/bills/{billId}/still-owed": {
      "post": {
        "operationId": "confirmBillStillOwed",
        "summary": "Confirms that a bill is still owed after a payment was looked at.",
        "description": "Confirms that a bill is still owed after a payment was looked at. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "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/RecordBillFxRateResponse"
                }
              }
            }
          },
          "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/bills/{billId}/submit": {
      "post": {
        "operationId": "submitBill",
        "summary": "Submits a bill for approval.",
        "description": "Submits a bill for approval. Needs the `ledger:propose` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "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/RecordBillFxRateResponse"
                }
              }
            }
          },
          "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/bills/{billId}/supersede": {
      "post": {
        "operationId": "linkBillSupersede",
        "summary": "Records that one bill supersedes an earlier one.",
        "description": "Records that one bill supersedes an earlier one. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "supersedesBillId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "supersedesBillId"
                ],
                "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/LinkBillSupersedeResponse"
                }
              }
            }
          },
          "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/bills/{billId}/supersede/remove": {
      "post": {
        "operationId": "removeBillSupersede",
        "summary": "Removes the record that one bill supersedes another.",
        "description": "Removes the record that one bill supersedes another. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "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/LinkBillSupersedeResponse"
                }
              }
            }
          },
          "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/bills/{billId}/supplier": {
      "post": {
        "operationId": "setBillSupplier",
        "summary": "Sets the vendor a bill belongs to.",
        "description": "Sets the vendor a bill belongs to. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "vendorId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "matchId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "addAlias": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "vendorId"
                ],
                "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/ListBillSupplierMatchesResponse"
                }
              }
            }
          },
          "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/bills/{billId}/supplier-matches": {
      "get": {
        "operationId": "listBillSupplierMatches",
        "summary": "Lists the vendors a bill may belong to.",
        "description": "Lists the vendors a bill may belong to. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "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/ListBillSupplierMatchesResponse"
                }
              }
            }
          },
          "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/bills/{billId}/supplier-matches/{matchId}/decline": {
      "post": {
        "operationId": "declineSupplierMatch",
        "summary": "Declines a suggested vendor match for a bill.",
        "description": "Declines a suggested vendor match for a bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "matchId",
            "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": 200
                  }
                },
                "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/ListBillSupplierMatchesResponse"
                }
              }
            }
          },
          "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/bills/{billId}/supplier-notice-facts": {
      "get": {
        "operationId": "getSupplierNoticeFacts",
        "summary": "Returns the facts a supplier notice about a bill is built from.",
        "description": "Returns the facts a supplier notice about a bill is built from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "BILL_APPROVED",
                "BILL_HELD",
                "BILL_DECLINED",
                "CORRECTION_ASKED"
              ]
            }
          }
        ],
        "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": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "BILL_APPROVED",
                        "BILL_HELD",
                        "BILL_DECLINED",
                        "CORRECTION_ASKED"
                      ]
                    },
                    "offer": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "offered": {
                              "type": "boolean",
                              "const": true
                            },
                            "ticked": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "offered",
                            "ticked"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "offered": {
                              "type": "boolean",
                              "const": false
                            },
                            "why": {
                              "type": "string",
                              "enum": [
                                "NO_SUPPLIER",
                                "SUPPLIER_ARCHIVED",
                                "SUPPLIER_REFUSED",
                                "NO_RECIPIENT",
                                "NO_CONTACT",
                                "MODE_OFF"
                              ]
                            },
                            "sentence": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "offered",
                            "why",
                            "sentence"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "vendor": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/VendorOption1"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "defaultRecipient": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/RecipientsItem"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "contact": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "telephone": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "SETTINGS",
                                "ADDRESS_WATCHER"
                              ]
                            }
                          },
                          "required": [
                            "name",
                            "telephone",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "facts": {
                      "$ref": "#/components/schemas/DecisionFacts"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "DOCUMENT",
                          "SUPPLIER_NAME",
                          "DATE",
                          "TOTAL",
                          "REGISTRATION",
                          "TAX_SHOWN",
                          "RECIPIENT",
                          "TERMS",
                          "DESCRIPTIONS",
                          "TAX_DIFFERS",
                          "DOES_NOT_ADD_UP"
                        ]
                      }
                    },
                    "alreadyTold": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "recipientEmail": {
                              "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": [
                            "recipientEmail",
                            "by",
                            "on"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "openDraft": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "noticeId": {
                              "type": "string"
                            },
                            "recipientEmail": {
                              "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": [
                            "noticeId",
                            "recipientEmail",
                            "by",
                            "on"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "outboundApproved": {
                      "type": "boolean"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind",
                    "offer",
                    "vendor",
                    "defaultRecipient",
                    "contact",
                    "facts",
                    "items",
                    "alreadyTold",
                    "openDraft",
                    "outboundApproved",
                    "entityTimeZone"
                  ],
                  "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/bills/{billId}/supplier-notice-paragraph": {
      "post": {
        "operationId": "draftSupplierNoticeParagraph",
        "summary": "Drafts the paragraph of a supplier notice for one bill.",
        "description": "Drafts the paragraph of a supplier notice for one bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "BILL_HELD",
                      "BILL_DECLINED",
                      "CORRECTION_ASKED"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 280
                  }
                },
                "required": [
                  "kind",
                  "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"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "drafted": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "promptVersion": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNPARSABLE",
                            "REFUSED",
                            "FIGURE_INVENTED",
                            "CONTACT_DETAIL",
                            "BANKING_WORDS",
                            "DECISION_PROMISE",
                            "PAUSED_AFTER_THREE_UNUSED"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "resumesOn": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    }
                  },
                  "required": [
                    "drafted",
                    "promptVersion",
                    "why"
                  ],
                  "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/bills/{billId}/supplier-notices": {
      "post": {
        "operationId": "draftBillNotice",
        "summary": "Drafts a notice to the supplier about a bill.",
        "description": "Drafts a notice to the supplier about a bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "BILL_APPROVED",
                      "BILL_HELD",
                      "BILL_DECLINED",
                      "CORRECTION_ASKED"
                    ]
                  },
                  "recipientEmail": {
                    "type": "string",
                    "maxLength": 320,
                    "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,}$"
                  },
                  "sentence": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 8,
                        "maxLength": 600
                      },
                      "source": {
                        "type": "string",
                        "enum": [
                          "STANDARD",
                          "AGENT_DRAFT",
                          "AGENT_DRAFT_EDITED",
                          "PERSON"
                        ]
                      },
                      "promptVersion": {
                        "type": "string",
                        "maxLength": 60
                      }
                    },
                    "required": [
                      "text",
                      "source"
                    ],
                    "additionalProperties": false
                  },
                  "draftRequested": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "kind",
                  "recipientEmail"
                ],
                "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/DraftBankingNoticeResponse"
                }
              }
            }
          },
          "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/bills/{billId}/vendor-prefill": {
      "get": {
        "operationId": "getBillVendorPrefill",
        "summary": "Returns the vendor details a bill starts from.",
        "description": "Returns the vendor details a bill starts from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "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": {
                    "billId": {
                      "type": "string"
                    },
                    "displayName": {
                      "type": "string"
                    },
                    "taxNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "region": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "country": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "fromDocument": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "billId",
                    "displayName",
                    "taxNumber",
                    "region",
                    "country",
                    "fromDocument"
                  ],
                  "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/bills/{billId}/versions": {
      "get": {
        "operationId": "listBillVersions",
        "summary": "Lists the earlier versions of a bill.",
        "description": "Lists the earlier versions of a bill. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "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"
                          },
                          "number": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "revision": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "SUBMITTED",
                              "APPROVED",
                              "EDITED"
                            ]
                          },
                          "createdBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "createdAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "vendor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "billNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billDate": {
                            "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+$"
                          },
                          "entry": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "entryNumber": {
                                    "anyOf": [
                                      {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "DRAFT",
                                      "PROPOSED",
                                      "IN_REVIEW",
                                      "APPROVED",
                                      "POSTED",
                                      "DECLINED",
                                      "REVERSED"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "entryNumber",
                                  "status"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "decision": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "PENDING",
                                      "APPROVED",
                                      "EDITED_APPROVED",
                                      "REJECTED",
                                      "EXPIRED",
                                      "WITHDRAWN"
                                    ]
                                  },
                                  "reviewedBy": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "name"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "reviewedAt": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "minLength": 20
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "rejectReason": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "withdrawn": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "status",
                                  "reviewedBy",
                                  "reviewedAt",
                                  "rejectReason",
                                  "withdrawn"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "findings": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "severity": {
                                  "type": "string",
                                  "enum": [
                                    "BLOCKING",
                                    "WARNING",
                                    "NOTE"
                                  ]
                                },
                                "code": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "message": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "line": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "figures": {
                                  "type": "array",
                                  "items": {
                                    "$ref": "#/components/schemas/FiguresItem"
                                  }
                                },
                                "reference": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "severity",
                                "code",
                                "message",
                                "line",
                                "figures",
                                "reference"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "lineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "linesMissing": {
                            "type": "boolean"
                          },
                          "diff": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "head": {
                                    "$ref": "#/components/schemas/Head"
                                  },
                                  "lines": {
                                    "$ref": "#/components/schemas/Lines2"
                                  },
                                  "subtotalBeforeMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "subtotalAfterMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "taxBeforeMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "taxAfterMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "totalBeforeMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "totalAfterMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  }
                                },
                                "required": [
                                  "head",
                                  "lines",
                                  "subtotalBeforeMinor",
                                  "subtotalAfterMinor",
                                  "taxBeforeMinor",
                                  "taxAfterMinor",
                                  "totalBeforeMinor",
                                  "totalAfterMinor",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "number",
                          "revision",
                          "kind",
                          "createdBy",
                          "createdAt",
                          "vendor",
                          "billNumber",
                          "billDate",
                          "dueDate",
                          "currency",
                          "subtotalMinor",
                          "taxMinor",
                          "totalMinor",
                          "entry",
                          "reason",
                          "decision",
                          "findings",
                          "lineCount",
                          "linesMissing",
                          "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/bills/{billId}/void": {
      "post": {
        "operationId": "voidBill",
        "summary": "Voids a bill, reversing its posting.",
        "description": "Voids a bill, reversing its posting. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "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/RecordBillFxRateResponse"
                }
              }
            }
          },
          "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/bills/{billId}/withholding": {
      "get": {
        "operationId": "getBillWithholding",
        "summary": "Returns the withholding on a bill.",
        "description": "Returns the withholding on a bill. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 40,
              "type": "integer",
              "minimum": 1,
              "maximum": 40
            }
          },
          {
            "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/GetBillWithholdingResponse"
                }
              }
            }
          },
          "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": "stateBillWithholding",
        "summary": "Records the withholding on a bill.",
        "description": "Records the withholding on a bill. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "afterDecisionId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "decisions": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "lineId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "decision": {
                          "type": "string",
                          "enum": [
                            "IN_CANADA",
                            "OUTSIDE_CANADA",
                            "NOT_A_SERVICE"
                          ]
                        },
                        "note": {
                          "default": null,
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 500
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "PERSON",
                            "AGENT_DRAFT",
                            "AGENT_DRAFT_EDITED"
                          ]
                        },
                        "proposedDecision": {
                          "default": null,
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "IN_CANADA",
                                "OUTSIDE_CANADA",
                                "NOT_A_SERVICE"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "promptVersion": {
                          "default": null,
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 40
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "lineId",
                        "decision",
                        "source"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "afterDecisionId",
                  "decisions"
                ],
                "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/GetBillWithholdingResponse"
                }
              }
            }
          },
          "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/bills/{billId}/withholding/draft": {
      "post": {
        "operationId": "draftBillWithholding",
        "summary": "Drafts the withholding for a bill.",
        "description": "Drafts the withholding for a bill. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "billId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lineIds": {
                    "minItems": 1,
                    "maxItems": 40,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": [
                  "lineIds"
                ],
                "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": {
                    "drafted": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "lineId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "proposal": {
                                    "type": "string",
                                    "enum": [
                                      "IN_CANADA",
                                      "OUTSIDE_CANADA",
                                      "NOT_A_SERVICE",
                                      "CANNOT_TELL"
                                    ]
                                  },
                                  "quote": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "confidenceBp": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 10000
                                  }
                                },
                                "required": [
                                  "lineId",
                                  "proposal",
                                  "quote",
                                  "confidenceBp"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "lines"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "skipped": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "lineId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "because": {
                            "type": "string",
                            "const": "DECLINED_BEFORE"
                          }
                        },
                        "required": [
                          "lineId",
                          "because"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "PROVIDER",
                            "BUDGET",
                            "REFUSED",
                            "TRUNCATED",
                            "UNPARSABLE",
                            "UNSAFE_ANSWER",
                            "NOTHING_TO_DRAFT",
                            "STOPPED_AFTER_THREE_OVERRIDES",
                            "SLOW"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "promptVersion": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "drafted",
                    "skipped",
                    "why",
                    "promptVersion"
                  ],
                  "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/budgets": {
      "get": {
        "operationId": "listBudgets",
        "summary": "Lists the budgets on the ledger.",
        "description": "Lists the budgets on the ledger. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "fiscalYear",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 2000,
              "maximum": 2100
            }
          },
          {
            "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"
                          },
                          "name": {
                            "type": "string"
                          },
                          "fiscalYear": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "fiscalYearEndMonth": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 12
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "currency": {
                            "type": "string"
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "approved": {
                            "type": "boolean"
                          },
                          "approvedByName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "approvedAt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdById": {
                            "type": "string"
                          },
                          "createdByName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "lineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "excludedLineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "excludedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "entityName",
                          "name",
                          "fiscalYear",
                          "fiscalYearEndMonth",
                          "currency",
                          "version",
                          "approved",
                          "approvedByName",
                          "approvedAt",
                          "createdById",
                          "createdByName",
                          "createdAt",
                          "lineCount",
                          "totalMinor",
                          "excludedLineCount",
                          "excludedMinor"
                        ],
                        "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": "createBudget",
        "summary": "Creates a budget for a period with its lines.",
        "description": "Creates a budget for a period with its lines. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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
                  },
                  "fiscalYear": {
                    "type": "integer",
                    "minimum": 2000,
                    "maximum": 2100
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "lines": {
                    "minItems": 1,
                    "maxItems": 2400,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "accountId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "periodMonth": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 12
                        },
                        "amountMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "accountId",
                        "periodMonth",
                        "amountMinor"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "entityId",
                  "fiscalYear",
                  "name",
                  "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/CreateBudgetResponse"
                }
              }
            }
          },
          "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/budgets/variance": {
      "get": {
        "operationId": "budgetVariance",
        "summary": "Returns the budget against actual for each budget line.",
        "description": "Returns the budget against actual for each budget line. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "fiscalYear",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 2000,
              "maximum": 2100
            }
          },
          {
            "name": "fromMonth",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          },
          {
            "name": "toMonth",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          }
        ],
        "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"
                    },
                    "fiscalYear": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "fromMonth": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "toMonth": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "window": {
                      "$ref": "#/components/schemas/Window"
                    },
                    "windowFiscalYearEndMonth": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 12
                    },
                    "entityFiscalYearEndMonth": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 12
                    },
                    "currency": {
                      "type": "string"
                    },
                    "budgetName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "budgetVersion": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "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"
                            ]
                          },
                          "budgetMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "actualMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "varianceMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "favourable": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          },
                          "varianceBp": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "committedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "accountId",
                          "code",
                          "name",
                          "type",
                          "budgetMinor",
                          "actualMinor",
                          "varianceMinor",
                          "favourable",
                          "varianceBp",
                          "committedMinor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "budgetMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "actualMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "varianceMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "committedMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "unbudgetedCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "unspentCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "excludedBalanceSheetLines": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "entityId",
                    "entityName",
                    "fiscalYear",
                    "fromMonth",
                    "toMonth",
                    "window",
                    "windowFiscalYearEndMonth",
                    "entityFiscalYearEndMonth",
                    "currency",
                    "budgetName",
                    "budgetVersion",
                    "rows",
                    "budgetMinor",
                    "actualMinor",
                    "varianceMinor",
                    "committedMinor",
                    "unbudgetedCount",
                    "unspentCount",
                    "excludedBalanceSheetLines"
                  ],
                  "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/budgets/{budgetId}/approve": {
      "post": {
        "operationId": "approveBudget",
        "summary": "Approves a budget so that it becomes the one measured against.",
        "description": "Approves a budget so that it becomes the one measured against. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "budgetId",
            "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/CreateBudgetResponse"
                }
              }
            }
          },
          "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/capital-purchases/look-back": {
      "post": {
        "operationId": "capitalLookBack",
        "summary": "Starts a look back over a company's bills for capital purchases the ledger missed, and answers the job to follow.",
        "description": "Starts a look back over a company's bills for capital purchases the ledger missed, and answers the job to follow. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
                  },
                  "from": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "entityId",
                  "from"
                ],
                "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/card-receipts": {
      "get": {
        "operationId": "listCardReceipts",
        "summary": "Lists the card receipts, with the server's total.",
        "description": "Lists the card receipts, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "MATCH_FOUND",
                "WAITING_FOR_FEED",
                "NO_LINE_FOUND"
              ]
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "date_desc",
                "date_asc",
                "amount_desc"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "financialAccountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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}$"
            }
          },
          {
            "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": {
                          "billId": {
                            "type": "string"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "IN_REVIEW",
                              "APPROVED"
                            ]
                          },
                          "supplier": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "vendorId": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "name",
                              "vendorId"
                            ],
                            "additionalProperties": false
                          },
                          "entity": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "billDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "tender": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "CARD"
                              },
                              "brand": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "VISA",
                                      "MASTERCARD",
                                      "AMEX",
                                      "DEBIT",
                                      "OTHER"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "last4": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^[0-9]{4}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "kind",
                              "brand",
                              "last4"
                            ],
                            "additionalProperties": false
                          },
                          "documentId": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "MATCH_FOUND",
                              "WAITING_FOR_FEED",
                              "NO_LINE_FOUND"
                            ]
                          },
                          "candidate": {
                            "$ref": "#/components/schemas/FeedCandidate"
                          },
                          "candidatesTotal": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "inPaymentQueue": {
                            "type": "boolean"
                          },
                          "nearMiss": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "sourceTransactionId": {
                                    "type": "string"
                                  },
                                  "txnDate": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "accountName": {
                                    "type": "string"
                                  },
                                  "amountMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "differenceMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  }
                                },
                                "required": [
                                  "sourceTransactionId",
                                  "txnDate",
                                  "description",
                                  "accountName",
                                  "amountMinor",
                                  "differenceMinor"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "otherCurrencyLines": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "billId",
                          "number",
                          "status",
                          "supplier",
                          "entity",
                          "billDate",
                          "currency",
                          "totalMinor",
                          "tender",
                          "documentId",
                          "state",
                          "candidate",
                          "candidatesTotal",
                          "inPaymentQueue",
                          "nearMiss",
                          "otherCurrencyLines"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "all": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "matchFound": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "waitingForFeed": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "noLineFound": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "all",
                        "matchFound",
                        "waitingForFeed",
                        "noLineFound"
                      ],
                      "additionalProperties": false
                    },
                    "cardFeeds": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "financialAccountId": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "lastLineOn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lastReadAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "financialAccountId",
                          "displayName",
                          "entityId",
                          "lastLineOn",
                          "lastReadAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "truncated": {
                      "type": "boolean"
                    },
                    "entityTimeZone": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "counts",
                    "cardFeeds",
                    "truncated",
                    "entityTimeZone"
                  ],
                  "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/card-receipts/lines": {
      "get": {
        "operationId": "listCardLines",
        "summary": "Lists the lines of card receipts.",
        "description": "Lists the lines of card receipts. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "MATCH_FOUND",
                "NEEDS_RECEIPT",
                "RECENT"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "date_desc",
                "date_asc",
                "amount_desc"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "financialAccountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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}$"
            }
          },
          {
            "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": {
                          "sourceTransactionId": {
                            "type": "string"
                          },
                          "account": {
                            "$ref": "#/components/schemas/Account2"
                          },
                          "entity": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "txnDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "description": {
                            "type": "string"
                          },
                          "counterparty": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "ageDays": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "MATCH_FOUND",
                              "NEEDS_RECEIPT",
                              "RECENT"
                            ]
                          },
                          "proposedFor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "billId": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "supplierName": {
                                    "type": "string"
                                  },
                                  "isReceipt": {
                                    "type": "boolean"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "IN_REVIEW",
                                      "APPROVED"
                                    ]
                                  },
                                  "scoreBp": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "billId",
                                  "number",
                                  "supplierName",
                                  "isReceipt",
                                  "status",
                                  "scoreBp"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "likelySupplier": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "vendorId": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "earlierPayments": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "vendorId",
                                  "name",
                                  "earlierPayments"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "documentary": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "tier": {
                                    "type": "string",
                                    "enum": [
                                      "UNDER_LOWER",
                                      "LOWER",
                                      "UPPER"
                                    ]
                                  },
                                  "thresholdMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "effectiveFrom": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "awaitingCpa": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "tier",
                                  "thresholdMinor",
                                  "effectiveFrom",
                                  "awaitingCpa"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "sourceTransactionId",
                          "account",
                          "entity",
                          "txnDate",
                          "description",
                          "counterparty",
                          "amountMinor",
                          "currency",
                          "ageDays",
                          "state",
                          "proposedFor",
                          "likelySupplier",
                          "documentary"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "all": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "matchFound": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "needsReceipt": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "recent": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "all",
                        "matchFound",
                        "needsReceipt",
                        "recent"
                      ],
                      "additionalProperties": false
                    },
                    "truncated": {
                      "type": "boolean"
                    },
                    "entityTimeZone": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "counts",
                    "truncated",
                    "entityTimeZone"
                  ],
                  "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/chart-imports": {
      "get": {
        "operationId": "listChartImports",
        "summary": "Lists the chart of accounts imports and where each one stands.",
        "description": "Lists the chart of accounts imports and where each one stands. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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",
                "APPROVED"
              ]
            }
          },
          {
            "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"
                          },
                          "format": {
                            "type": "string",
                            "enum": [
                              "QBO",
                              "SAGE50",
                              "GENERIC"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "REVIEW",
                              "APPROVED"
                            ]
                          },
                          "rowCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "groupCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "skippedCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "uploadedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "createdAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "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"
                              }
                            ]
                          },
                          "accountsCreated": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "dimensionValuesCreated": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "dimensionPoliciesCreated": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "entityName",
                          "fileName",
                          "format",
                          "status",
                          "rowCount",
                          "groupCount",
                          "skippedCount",
                          "uploadedBy",
                          "createdAt",
                          "approvedBy",
                          "approvedAt",
                          "accountsCreated",
                          "dimensionValuesCreated",
                          "dimensionPoliciesCreated"
                        ],
                        "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": "createChartImport",
        "summary": "Starts an import of a chart of accounts from an uploaded file.",
        "description": "Starts an import of a chart of accounts from an uploaded file. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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
                  },
                  "fileName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "csv": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000000
                  }
                },
                "required": [
                  "entityId",
                  "fileName",
                  "csv"
                ],
                "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/CreateChartImportResponse"
                }
              }
            }
          },
          "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/chart-imports/{importId}": {
      "get": {
        "operationId": "getChartImport",
        "summary": "Returns one chart of accounts import with its rows and findings.",
        "description": "Returns one chart of accounts import with its rows and findings. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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/CreateChartImportResponse"
                }
              }
            }
          },
          "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/chart-imports/{importId}/approve": {
      "post": {
        "operationId": "approveChartImport",
        "summary": "Approves a chart of accounts import so its accounts are created.",
        "description": "Approves a chart of accounts import so its accounts are created. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "importId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "declinedGroups": {
                    "default": [],
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  }
                },
                "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": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "REVIEW",
                        "APPROVED"
                      ]
                    },
                    "accountsCreated": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "dimensionValuesCreated": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "dimensionPoliciesCreated": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "dimensionTypeCode": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "declinedGroups": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "accountsWithoutGifi": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "accountsCreated",
                    "dimensionValuesCreated",
                    "dimensionPoliciesCreated",
                    "dimensionTypeCode",
                    "declinedGroups",
                    "accountsWithoutGifi",
                    "replayed"
                  ],
                  "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/close": {
      "get": {
        "operationId": "closeChecklist",
        "summary": "Returns the close checklist for the month and what is still open on it.",
        "description": "Returns the close checklist for the month and what is still open on it. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "year",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 2000,
              "maximum": 2100
            }
          },
          {
            "name": "month",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          }
        ],
        "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/CloseChecklistResponse"
                }
              }
            }
          },
          "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/close/allowance/propose": {
      "post": {
        "operationId": "proposeAllowanceAdjustment",
        "summary": "Proposes an adjustment to the bad debt allowance for a person to decide.",
        "description": "Proposes an adjustment to the bad debt allowance for a person to decide. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartCloseRequest"
              }
            }
          }
        },
        "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": {
                    "entryId": {
                      "type": "string"
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 3
                    },
                    "changeMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "targetMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "entryDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    }
                  },
                  "required": [
                    "entryId",
                    "created",
                    "status",
                    "currency",
                    "changeMinor",
                    "targetMinor",
                    "entryDate"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/close/customer-credit/reclass": {
      "post": {
        "operationId": "proposeCustomerCreditReclass",
        "summary": "Proposes a reclassification of customer credit balances for a person to decide.",
        "description": "Proposes a reclassification of customer credit balances for a person to decide. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartCloseRequest"
              }
            }
          }
        },
        "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": {
                    "entryId": {
                      "type": "string"
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 3
                    },
                    "amountMinor": {
                      "type": "string"
                    },
                    "customers": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "entryDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "reversalDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    }
                  },
                  "required": [
                    "entryId",
                    "created",
                    "status",
                    "currency",
                    "amountMinor",
                    "customers",
                    "entryDate",
                    "reversalDate"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/close/flux": {
      "get": {
        "operationId": "fluxFacts",
        "summary": "Returns the account movements a flux narrative for one month is written from.",
        "description": "Returns the account movements a flux narrative for one month is written from. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "year",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 2000,
              "maximum": 2100
            }
          },
          {
            "name": "month",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          }
        ],
        "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"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "period": {
                      "$ref": "#/components/schemas/Period"
                    },
                    "priorPeriod": {
                      "$ref": "#/components/schemas/Period"
                    },
                    "priorYearPeriod": {
                      "$ref": "#/components/schemas/Period"
                    },
                    "thresholdBp": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "floorMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "budget": {
                      "$ref": "#/components/schemas/Budget"
                    },
                    "accounts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "accountId": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "REVENUE",
                              "EXPENSE"
                            ]
                          },
                          "monthMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "priorMonthMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "priorYearMonthMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "budgetMonthMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "varianceOnPriorMonthMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "varianceOnPriorYearMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "varianceOnBudgetMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "changeBp": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "flagged": {
                            "type": "boolean"
                          },
                          "thresholdMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "entries": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "entryId": {
                                  "type": "string"
                                },
                                "entryNumber": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "entryDate": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "memo": {
                                  "type": "string"
                                },
                                "amountMinor": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                }
                              },
                              "required": [
                                "entryId",
                                "entryNumber",
                                "entryDate",
                                "memo",
                                "amountMinor"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "contributorsRead": {
                            "type": "boolean"
                          },
                          "explainedBp": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 10000
                          }
                        },
                        "required": [
                          "accountId",
                          "code",
                          "name",
                          "type",
                          "monthMinor",
                          "priorMonthMinor",
                          "priorYearMonthMinor",
                          "budgetMonthMinor",
                          "varianceOnPriorMonthMinor",
                          "varianceOnPriorYearMinor",
                          "varianceOnBudgetMinor",
                          "changeBp",
                          "flagged",
                          "thresholdMinor",
                          "entries",
                          "contributorsRead",
                          "explainedBp"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "flaggedCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "truncated": {
                      "type": "boolean"
                    },
                    "factsDigest": {
                      "type": "string"
                    },
                    "note": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/NoteOption1"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "entityId",
                    "entityName",
                    "currency",
                    "period",
                    "priorPeriod",
                    "priorYearPeriod",
                    "thresholdBp",
                    "floorMinor",
                    "budget",
                    "accounts",
                    "flaggedCount",
                    "truncated",
                    "factsDigest",
                    "note"
                  ],
                  "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/close/flux/decide": {
      "post": {
        "operationId": "decideFlux",
        "summary": "Accepts or declines a drafted flux narrative for one month.",
        "description": "Accepts or declines a drafted flux narrative for one month. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "noteId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "decision": {
                    "type": "string",
                    "enum": [
                      "ACCEPT",
                      "DECLINE"
                    ]
                  },
                  "blocks": {
                    "maxItems": 40,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "accountId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 2000
                        }
                      },
                      "required": [
                        "accountId",
                        "text"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "required": [
                  "noteId",
                  "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/NoteOption1"
                }
              }
            }
          },
          "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/close/flux/draft": {
      "post": {
        "operationId": "draftFlux",
        "summary": "Drafts the flux narrative that explains why each account moved in one closed month.",
        "description": "Drafts the flux narrative that explains why each account moved in one closed month. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartCloseRequest"
              }
            }
          }
        },
        "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/NoteOption1"
                }
              }
            }
          },
          "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/close/flux/notes": {
      "get": {
        "operationId": "listFluxNotes",
        "summary": "Lists the month-end flux narratives waiting for a decision, oldest first.",
        "description": "Lists the month-end flux narratives waiting for a decision, oldest first. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "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": [
                "PROPOSED",
                "ACCEPTED",
                "DECLINED"
              ]
            }
          },
          {
            "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/NoteOption1"
                      }
                    },
                    "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/close/fx-revaluation/propose": {
      "post": {
        "operationId": "proposeFxRevaluation",
        "summary": "Proposes the foreign currency revaluation entry for a closing month.",
        "description": "Proposes the foreign currency revaluation entry for a closing month. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartCloseRequest"
              }
            }
          }
        },
        "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": {
                    "entryId": {
                      "type": "string"
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 3
                    },
                    "adjustmentMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "currencies": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "entryDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "reversalDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    }
                  },
                  "required": [
                    "entryId",
                    "created",
                    "status",
                    "currency",
                    "adjustmentMinor",
                    "currencies",
                    "entryDate",
                    "reversalDate"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/close/received-not-invoiced/propose": {
      "post": {
        "operationId": "proposeReceivedNotInvoiced",
        "summary": "Proposes the accrual for goods received but not yet invoiced, for a person to decide.",
        "description": "Proposes the accrual for goods received but not yet invoiced, for a person to decide. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartCloseRequest"
              }
            }
          }
        },
        "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": {
                    "entryId": {
                      "type": "string"
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "totalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "orderCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "lineCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "entryDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "reversalDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    }
                  },
                  "required": [
                    "entryId",
                    "created",
                    "status",
                    "currency",
                    "totalMinor",
                    "orderCount",
                    "lineCount",
                    "entryDate",
                    "reversalDate"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/close/start": {
      "post": {
        "operationId": "startClose",
        "summary": "Starts the month-end close for a period.",
        "description": "Starts the month-end close for a period. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartCloseRequest"
              }
            }
          }
        },
        "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/CloseChecklistResponse"
                }
              }
            }
          },
          "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/close/tasks/sign": {
      "post": {
        "operationId": "signCloseTask",
        "summary": "Signs off one close task as the person who completed it.",
        "description": "Signs off one close task as the person who completed it. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "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
                  },
                  "periodYear": {
                    "type": "integer",
                    "minimum": 2000,
                    "maximum": 2100
                  },
                  "periodMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "ACCRUALS_REVIEWED",
                      "FLUX_REVIEWED",
                      "CUSTOM"
                    ]
                  },
                  "signed": {
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 500
                  }
                },
                "required": [
                  "entityId",
                  "periodYear",
                  "periodMonth",
                  "kind",
                  "signed"
                ],
                "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/CloseChecklistResponse"
                }
              }
            }
          },
          "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/company-scope/impact": {
      "get": {
        "operationId": "getCompanyScopeImpact",
        "summary": "Returns what narrowing a person's companies would change.",
        "description": "Returns what narrowing a person's companies would change. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "ledgerId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "userId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "ALL",
                "SOME"
              ]
            }
          },
          {
            "name": "keep",
            "in": "query",
            "required": false,
            "description": "Company ids, separated by commas, at most 100.",
            "schema": {
              "type": "string",
              "description": "Company ids, separated by commas, at most 100."
            }
          }
        ],
        "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": {
                    "userId": {
                      "type": "string"
                    },
                    "lostCompanies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "shortName": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "deskBills": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "authorityRows": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "inboxAddresses": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "computedAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "userId",
                    "lostCompanies",
                    "deskBills",
                    "authorityRows",
                    "inboxAddresses",
                    "computedAt"
                  ],
                  "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/company-scope/suggestions": {
      "get": {
        "operationId": "listCompanyScopeSuggestions",
        "summary": "Lists the company scope changes the ledger suggests.",
        "description": "Lists the company scope changes the ledger suggests. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "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": {
                          "userId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string"
                          },
                          "windowDays": {
                            "type": "number",
                            "const": 90
                          },
                          "actions": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "byCompany": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "entityId": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "actions": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "entityId",
                                "name",
                                "actions"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "suggest": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "shortName": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "companiesOnBooks": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "userId",
                          "name",
                          "role",
                          "windowDays",
                          "actions",
                          "byCompany",
                          "suggest",
                          "companiesOnBooks"
                        ],
                        "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/compliance/deadlines": {
      "get": {
        "operationId": "listDeadlines",
        "summary": "Lists the compliance deadlines the company faces.",
        "description": "Lists the compliance deadlines the company faces. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OVERDUE",
                "DUE_SOON",
                "UPCOMING",
                "DONE"
              ]
            }
          }
        ],
        "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}$"
                    },
                    "timeZone": {
                      "type": "string"
                    },
                    "from": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "to": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "deadlines": {
                      "$ref": "#/components/schemas/Deadlines"
                    },
                    "companies": {
                      "type": "object",
                      "properties": {
                        "listed": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "listed",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "overdue": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "dueSoon": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "upcoming": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "done": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "overdue",
                        "dueSoon",
                        "upcoming",
                        "done"
                      ],
                      "additionalProperties": false
                    },
                    "overdue": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "since": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "oldestDueDate": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "rows": {
                          "$ref": "#/components/schemas/Deadlines"
                        }
                      },
                      "required": [
                        "count",
                        "since",
                        "oldestDueDate",
                        "rows"
                      ],
                      "additionalProperties": false
                    },
                    "withoutProfile": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "note": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "entityId",
                          "entityName",
                          "note"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "instalments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "taxRegistrationId": {
                            "type": "string"
                          },
                          "registrationNumber": {
                            "type": "string"
                          },
                          "periodLabel": {
                            "type": "string"
                          },
                          "note": {
                            "type": "string"
                          },
                          "basis": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "entityId",
                          "entityName",
                          "taxRegistrationId",
                          "registrationNumber",
                          "periodLabel",
                          "note",
                          "basis"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "asOf",
                    "timeZone",
                    "from",
                    "to",
                    "deadlines",
                    "companies",
                    "counts",
                    "overdue",
                    "withoutProfile",
                    "notes",
                    "instalments"
                  ],
                  "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/compliance/deadlines/mark": {
      "post": {
        "operationId": "markDeadline",
        "summary": "Marks a compliance deadline as met or missed.",
        "description": "Marks a compliance deadline as met or missed. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "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
                  },
                  "kind": {
                    "$ref": "#/components/schemas/Kind6"
                  },
                  "periodKey": {
                    "type": "string",
                    "pattern": "^[0-9]{4}(-Q[1-4]|-[0-9]{2}(-[0-9]{2}(-[1-4])?)?)?$"
                  },
                  "dueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "taxRegistrationId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "mark": {
                    "type": "string",
                    "enum": [
                      "DONE",
                      "REOPENED"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 1000
                  }
                },
                "required": [
                  "entityId",
                  "kind",
                  "periodKey",
                  "dueDate",
                  "mark"
                ],
                "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": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "kind": {
                      "$ref": "#/components/schemas/Kind6"
                    },
                    "periodKey": {
                      "type": "string",
                      "pattern": "^[0-9]{4}(-Q[1-4]|-[0-9]{2}(-[0-9]{2}(-[1-4])?)?)?$"
                    },
                    "dueDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "taxRegistrationId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "mark": {
                      "type": "string",
                      "enum": [
                        "DONE",
                        "REOPENED"
                      ]
                    },
                    "note": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "markedBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "markedAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "id",
                    "entityId",
                    "kind",
                    "periodKey",
                    "dueDate",
                    "taxRegistrationId",
                    "mark",
                    "note",
                    "markedBy",
                    "markedAt"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/compliance/profile": {
      "get": {
        "operationId": "getComplianceProfile",
        "summary": "Returns the compliance profile of the company.",
        "description": "Returns the compliance profile of the company. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "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": {
                  "type": "object",
                  "properties": {
                    "entity": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "legalForm": {
                          "type": "string"
                        },
                        "fiscalYearEndMonth": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 12
                        },
                        "incorporatedOn": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "region": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "timeZone": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "legalForm",
                        "fiscalYearEndMonth",
                        "incorporatedOn",
                        "region",
                        "timeZone"
                      ],
                      "additionalProperties": false
                    },
                    "profile": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ProfileOption1"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "entity",
                    "profile"
                  ],
                  "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": "upsertComplianceProfile",
        "summary": "Saves the compliance profile of the company.",
        "description": "Saves the compliance profile of the company. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "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
                  },
                  "payrollRemitter": {
                    "type": "string",
                    "enum": [
                      "NONE",
                      "QUARTERLY",
                      "REGULAR",
                      "ACCELERATED_1",
                      "ACCELERATED_2"
                    ]
                  },
                  "corporateInstalments": {
                    "type": "string",
                    "enum": [
                      "NONE",
                      "MONTHLY",
                      "QUARTERLY"
                    ]
                  },
                  "balanceDueMonths": {
                    "anyOf": [
                      {
                        "type": "number",
                        "const": 2
                      },
                      {
                        "type": "number",
                        "const": 3
                      }
                    ]
                  },
                  "issuesT4": {
                    "type": "boolean"
                  },
                  "issuesT4A": {
                    "type": "boolean"
                  },
                  "issuesT5": {
                    "type": "boolean"
                  },
                  "issuesT5018": {
                    "type": "boolean"
                  },
                  "t5018Period": {
                    "type": "string",
                    "enum": [
                      "CALENDAR",
                      "FISCAL"
                    ]
                  },
                  "registry": {
                    "type": "string",
                    "enum": [
                      "NONE",
                      "FEDERAL",
                      "ONTARIO",
                      "OTHER"
                    ]
                  },
                  "filesEht": {
                    "type": "boolean"
                  },
                  "ehtInstalments": {
                    "type": "boolean"
                  },
                  "filesWsib": {
                    "type": "boolean"
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "payrollAccountNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9]{9}RP[0-9]{4}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contractAccountNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9]{9}RZ[0-9]{4}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "transmitterAccountNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9]{9}([A-Z]{2}[0-9]{4})?$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "filerName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 30
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "filerAddressLine1": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 30
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "filerAddressLine2": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 30
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "filerCity": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 28
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "filerRegion": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{2}-[A-Z0-9]{1,3}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "filerPostalCode": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z0-9 ]{1,10}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contactName": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 35
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contactPhone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[0-9]{10}(x[0-9]{1,5})?$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "contactEmail": {
                    "$ref": "#/components/schemas/ContactEmail"
                  }
                },
                "required": [
                  "entityId",
                  "payrollRemitter",
                  "corporateInstalments",
                  "balanceDueMonths",
                  "issuesT4",
                  "issuesT4A",
                  "issuesT5",
                  "issuesT5018",
                  "t5018Period",
                  "registry",
                  "filesEht",
                  "ehtInstalments",
                  "filesWsib",
                  "notes"
                ],
                "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/ProfileOption1"
                }
              }
            }
          },
          "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/confirmations/{confirmationId}": {
      "get": {
        "operationId": "getConfirmation",
        "summary": "Returns one held change waiting for a person: what it would do, why it was held and whether it was decided.",
        "description": "Returns one held change waiting for a person: what it would do, why it was held and whether it was decided. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "confirmationId",
            "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"
                    },
                    "ledgerId": {
                      "type": "string"
                    },
                    "ledgerName": {
                      "type": "string"
                    },
                    "operation": {
                      "type": "string"
                    },
                    "summary": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string",
                      "enum": [
                        "effect_class",
                        "batch"
                      ]
                    },
                    "appName": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "PENDING",
                        "APPROVED",
                        "REJECTED",
                        "EXPIRED"
                      ]
                    },
                    "expiresAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "decidedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "decidedByName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "change": {
                      "type": "object",
                      "properties": {
                        "before": {
                          "anyOf": [
                            {},
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "after": {}
                      },
                      "required": [
                        "before",
                        "after"
                      ],
                      "additionalProperties": false
                    },
                    "batch": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "groupId": {
                              "type": "string"
                            },
                            "recordCount": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "groupId",
                            "recordCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "ledgerId",
                    "ledgerName",
                    "operation",
                    "summary",
                    "reason",
                    "appName",
                    "status",
                    "expiresAt",
                    "decidedAt",
                    "decidedByName",
                    "change",
                    "batch"
                  ],
                  "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/connections": {
      "get": {
        "operationId": "listConnections",
        "summary": "Lists the connections to outside systems, with their status.",
        "description": "Lists the connections to outside systems, with their status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "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": {
                          "id": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "ACTIVE",
                              "PAUSED",
                              "ERROR",
                              "REVOKED"
                            ]
                          },
                          "capabilities": {
                            "$ref": "#/components/schemas/Capabilities"
                          },
                          "lastSyncAt": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "connectedByName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "stagedCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "matchedCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "newCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "latestSyncRunId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "registeredAccounts": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "displayName": {
                                  "type": "string"
                                },
                                "glAccountCode": {
                                  "type": "string"
                                },
                                "glAccountName": {
                                  "type": "string"
                                },
                                "entityId": {
                                  "type": "string"
                                },
                                "entityName": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "displayName",
                                "glAccountCode",
                                "glAccountName",
                                "entityId",
                                "entityName"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "sync": {
                            "$ref": "#/components/schemas/Sync"
                          },
                          "zumRails": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "environment": {
                                    "type": "string",
                                    "enum": [
                                      "SANDBOX",
                                      "PRODUCTION"
                                    ]
                                  },
                                  "fundingSourceLabel": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "environment",
                                  "fundingSourceLabel"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "provider",
                          "displayName",
                          "status",
                          "capabilities",
                          "lastSyncAt",
                          "connectedByName",
                          "stagedCount",
                          "matchedCount",
                          "newCount",
                          "latestSyncRunId",
                          "registeredAccounts",
                          "sync",
                          "zumRails"
                        ],
                        "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/connections/hubspot/deals": {
      "get": {
        "operationId": "hubSpotDeals",
        "summary": "Lists the deals held in HubSpot.",
        "description": "Lists the deals held in HubSpot. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "connectionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          }
        ],
        "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/HubSpotDealsResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "connectionId": {
                      "type": "string"
                    },
                    "portalId": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "connectionId",
                    "portalId"
                  ],
                  "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/connections/hubspot/deals/{dealId}": {
      "get": {
        "operationId": "hubSpotDeal",
        "summary": "Returns one deal held in HubSpot.",
        "description": "Returns one deal held in HubSpot. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "dealId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "connectionId",
            "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": {
                    "connectionId": {
                      "type": "string"
                    },
                    "portalId": {
                      "type": "string"
                    },
                    "deal": {
                      "$ref": "#/components/schemas/HubSpotDealsResponseItem"
                    }
                  },
                  "required": [
                    "connectionId",
                    "portalId",
                    "deal"
                  ],
                  "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/connections/provider-read-requests": {
      "post": {
        "operationId": "requestProviderRead",
        "summary": "Asks for QuickBooks, Xero, Stripe, HubSpot or Salesforce records to be read now into a batch for review.",
        "description": "Asks for QuickBooks, Xero, Stripe, HubSpot or Salesforce records to be read now into a batch for review. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "read": {
                    "$ref": "#/components/schemas/Read"
                  },
                  "connectionId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "cutoverId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "revenueAccountId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "read",
                  "connectionId"
                ],
                "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": {
                    "connectionId": {
                      "type": "string"
                    },
                    "read": {
                      "$ref": "#/components/schemas/Read"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "requestedAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "connectionId",
                    "read",
                    "requestId",
                    "requestedAt"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/connections/qbo/accounts": {
      "get": {
        "operationId": "qboFeedAccounts",
        "summary": "Lists the accounts of a QuickBooks Online feed.",
        "description": "Lists the accounts of a QuickBooks Online feed. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "connectionId",
            "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": {
                    "connectionId": {
                      "type": "string"
                    },
                    "realmId": {
                      "type": "string"
                    },
                    "accounts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "accountType": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "accountType",
                          "currency"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "connectionId",
                    "realmId",
                    "accounts"
                  ],
                  "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/connections/qbo/feeds": {
      "get": {
        "operationId": "qboFeeds",
        "summary": "Lists the QuickBooks Online feeds connected to the ledger.",
        "description": "Lists the QuickBooks Online feeds connected to the ledger. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "connectionId",
            "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": {
                  "$ref": "#/components/schemas/StripeFeedsResponse"
                }
              }
            }
          },
          "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": "switchQboFeed",
        "summary": "Switches the QuickBooks Online feed the ledger reads.",
        "description": "Switches the QuickBooks Online feed the ledger reads. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "financialAccountId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "qboAccountId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "connectionId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "financialAccountId",
                  "qboAccountId"
                ],
                "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/CutoversItem"
                }
              }
            }
          },
          "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/connections/stripe/customers": {
      "get": {
        "operationId": "listStripeCustomers",
        "summary": "Lists the customers held in Stripe.",
        "description": "Lists the customers held in Stripe. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "connectionId",
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "email": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "linkedTo": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "customerId": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "customerId",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "email",
                          "linkedTo"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "truncated": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "truncated"
                  ],
                  "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/connections/stripe/feeds": {
      "get": {
        "operationId": "stripeFeeds",
        "summary": "Lists the Stripe feeds connected to the ledger.",
        "description": "Lists the Stripe feeds connected to the ledger. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "connectionId",
            "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": {
                  "$ref": "#/components/schemas/StripeFeedsResponse"
                }
              }
            }
          },
          "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": "switchStripeFeed",
        "summary": "Switches the Stripe feed the ledger reads.",
        "description": "Switches the Stripe feed the ledger reads. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "financialAccountId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "stripeAccountId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "connectionId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "financialAccountId",
                  "stripeAccountId"
                ],
                "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/CutoversItem"
                }
              }
            }
          },
          "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/connections/sync-requests": {
      "post": {
        "operationId": "requestConnectionSync",
        "summary": "Asks for a connected bank feed or sales platform to be read now, and answers the run to follow in listConnectionSyncRuns.",
        "description": "Asks for a connected bank feed or sales platform to be read now, and answers the run to follow in listConnectionSyncRuns. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "connectionId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "target": {
                    "$ref": "#/components/schemas/Target"
                  }
                },
                "required": [
                  "connectionId"
                ],
                "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": {
                    "connectionId": {
                      "type": "string"
                    },
                    "syncRunId": {
                      "type": "string"
                    },
                    "existing": {
                      "type": "boolean"
                    },
                    "startedAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "connectionId",
                    "syncRunId",
                    "existing",
                    "startedAt"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/connections/{connectionId}/account-suggestion": {
      "post": {
        "operationId": "suggestFeedAccount",
        "summary": "Suggests the account a connection's feed should post to.",
        "description": "Suggests the account a connection's feed should post to. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "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/SuggestFeedAccountResponse"
                }
              }
            }
          },
          "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/connections/{connectionId}/sync-runs": {
      "get": {
        "operationId": "listConnectionSyncRuns",
        "summary": "Lists the sync runs of a connection, newest first.",
        "description": "Lists the sync runs of a connection, newest first. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "trigger",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "SCHEDULED",
                "BY_HAND"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 400
            }
          }
        ],
        "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"
                          },
                          "startedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "finishedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "trigger": {
                            "type": "string",
                            "enum": [
                              "SCHEDULED",
                              "BY_HAND"
                            ]
                          },
                          "scheduledFor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "continuation": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "result": {
                            "type": "string",
                            "enum": [
                              "RUNNING",
                              "COMPLETED",
                              "TRUNCATED",
                              "FAILED"
                            ]
                          },
                          "failure": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "fetched": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "staged": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "remainingCount": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "windowStart": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "windowEnd": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "ranAs": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "timeZone": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "id",
                          "startedAt",
                          "finishedAt",
                          "trigger",
                          "scheduledFor",
                          "continuation",
                          "result",
                          "failure",
                          "fetched",
                          "staged",
                          "remainingCount",
                          "windowStart",
                          "windowEnd",
                          "ranAs",
                          "timeZone"
                        ],
                        "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/connections/{connectionId}/sync-schedule": {
      "put": {
        "operationId": "setConnectionSyncSchedule",
        "summary": "Sets how often a connection syncs.",
        "description": "Sets how often a connection syncs. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "connectionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "schedule": {
                    "$ref": "#/components/schemas/Cron"
                  },
                  "timeZone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "target": {
                    "$ref": "#/components/schemas/Target"
                  },
                  "endsOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "schedule",
                  "timeZone"
                ],
                "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/Sync"
                }
              }
            }
          },
          "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/connections/{connectionId}/sync-schedule/clear": {
      "post": {
        "operationId": "clearConnectionSyncSchedule",
        "summary": "Clears the sync schedule of a connection.",
        "description": "Clears the sync schedule of a connection. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "connectionId",
            "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/Sync"
                }
              }
            }
          },
          "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/connections/{connectionId}/sync-schedule/resume": {
      "post": {
        "operationId": "resumeConnectionSync",
        "summary": "Resumes a connection's sync after it was suspended.",
        "description": "Resumes a connection's sync after it was suspended. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "connectionId",
            "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/Sync"
                }
              }
            }
          },
          "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/connectors": {
      "get": {
        "operationId": "listConnectors",
        "summary": "Lists the connectors the ledger can use.",
        "description": "Lists the connectors the ledger can use. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "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": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      },
                      "capabilities": {
                        "$ref": "#/components/schemas/Capabilities"
                      },
                      "auth": {
                        "type": "string",
                        "enum": [
                          "oauth2",
                          "apiKey",
                          "fileUpload",
                          "none"
                        ]
                      },
                      "configured": {
                        "type": "boolean"
                      },
                      "environment": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "label",
                      "capabilities",
                      "auth",
                      "configured",
                      "environment"
                    ],
                    "additionalProperties": false
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/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/controls/auto-approvals": {
      "get": {
        "operationId": "listControlAutoApprovals",
        "summary": "Lists the approvals the ledger's controls made without a person.",
        "description": "Lists the approvals the ledger's controls made without a person. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "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": "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"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "ENTRY",
                              "MATCH"
                            ]
                          },
                          "ruleId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "ruleSourceText": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "ruleVersion": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "authorName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entryId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entryRef": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entryDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "amountMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "currency": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reason": {
                            "type": "string"
                          },
                          "firedAt": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "ruleId",
                          "ruleSourceText",
                          "ruleVersion",
                          "authorName",
                          "entryId",
                          "entryRef",
                          "entryDate",
                          "amountMinor",
                          "currency",
                          "reason",
                          "firedAt"
                        ],
                        "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/controls/changes": {
      "get": {
        "operationId": "listControlChanges",
        "summary": "Lists the changes made to the ledger's controls.",
        "description": "Lists the changes made to the ledger's controls. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "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": "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"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "APPROVAL_CEILING",
                              "RULE_THRESHOLD",
                              "PERIOD_LOCK",
                              "APPROVAL_AUTHORITY",
                              "APPROVAL_ROUTING"
                            ]
                          },
                          "action": {
                            "type": "string"
                          },
                          "at": {
                            "type": "string",
                            "minLength": 20
                          },
                          "attribution": {
                            "type": "string"
                          },
                          "subject": {
                            "type": "string"
                          },
                          "beforeMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "afterMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "currency": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "detail": {
                            "type": "string"
                          },
                          "targetType": {
                            "type": "string"
                          },
                          "targetId": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "action",
                          "at",
                          "attribution",
                          "subject",
                          "beforeMinor",
                          "afterMinor",
                          "currency",
                          "detail",
                          "targetType",
                          "targetId"
                        ],
                        "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/controls/framework": {
      "get": {
        "operationId": "getControlsFramework",
        "summary": "Returns the controls framework the ledger is run against.",
        "description": "Returns the controls framework the ledger is run against. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "area",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "INVOICES"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "COVERED",
                "PARTIAL",
                "MISSING"
              ]
            }
          },
          {
            "name": "component",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "CONTROL_ENVIRONMENT",
                "RISK_ASSESSMENT",
                "CONTROL_ACTIVITIES",
                "INFORMATION_AND_COMMUNICATION",
                "MONITORING_ACTIVITIES"
              ]
            }
          },
          {
            "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": {
                          "key": {
                            "type": "string",
                            "pattern": "^[a-z]+\\.[a-z0-9-]+$"
                          },
                          "area": {
                            "type": "string",
                            "enum": [
                              "INVOICES"
                            ]
                          },
                          "control": {
                            "type": "string",
                            "minLength": 1
                          },
                          "component": {
                            "type": "string",
                            "enum": [
                              "CONTROL_ENVIRONMENT",
                              "RISK_ASSESSMENT",
                              "CONTROL_ACTIVITIES",
                              "INFORMATION_AND_COMMUNICATION",
                              "MONITORING_ACTIVITIES"
                            ]
                          },
                          "principle": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 17
                          },
                          "principleName": {
                            "type": "string",
                            "minLength": 1
                          },
                          "enforcement": {
                            "type": "string",
                            "minLength": 1
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "COVERED",
                              "PARTIAL",
                              "MISSING"
                            ]
                          },
                          "statusReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "evidenceHref": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "evidenceLabel": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "key",
                          "area",
                          "control",
                          "component",
                          "principle",
                          "principleName",
                          "enforcement",
                          "status",
                          "statusReason",
                          "evidenceHref",
                          "evidenceLabel"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "covered": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "partial": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "missing": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "covered",
                        "partial",
                        "missing"
                      ],
                      "additionalProperties": false
                    },
                    "computedAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "counts",
                    "computedAt"
                  ],
                  "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/controls/overrides": {
      "get": {
        "operationId": "listControlOverrides",
        "summary": "Lists the times a person overrode a control, with the reason given.",
        "description": "Lists the times a person overrode a control, with the reason given. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "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": "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"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "TAX",
                              "FX"
                            ]
                          },
                          "on": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "subject": {
                            "type": "string"
                          },
                          "entryId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "determined": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "chosen": {
                            "type": "string"
                          },
                          "amountMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "currency": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reason": {
                            "type": "string"
                          },
                          "byName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "at": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "on",
                          "subject",
                          "entryId",
                          "determined",
                          "chosen",
                          "amountMinor",
                          "currency",
                          "reason",
                          "byName",
                          "at"
                        ],
                        "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/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/custom-field-values/{recordKind}/{recordId}": {
      "put": {
        "operationId": "setCustomFieldValues",
        "summary": "Sets custom field values on a customer, invoice, credit note, product or contract. Send only changed fields: null clears one, one left out is kept.",
        "description": "Sets custom field values on a customer, invoice, credit note, product or contract. Send only changed fields: null clears one, one left out is kept. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "recordKind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetCustomFieldValuesRequest"
              }
            }
          }
        },
        "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": {
                    "recordKind": {
                      "type": "string",
                      "enum": [
                        "CUSTOMER",
                        "INVOICE",
                        "CREDIT_MEMO",
                        "PRODUCT",
                        "CONTRACT"
                      ]
                    },
                    "recordId": {
                      "type": "string"
                    },
                    "customFields": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "boolean"
                          },
                          {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "recordKind",
                    "recordId",
                    "customFields"
                  ],
                  "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/custom-fields": {
      "get": {
        "operationId": "listCustomFieldDefinitions",
        "summary": "Lists the custom fields the ledger defines for its records.",
        "description": "Lists the custom fields the ledger defines for its records. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "recordKind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "CUSTOMER",
                "INVOICE",
                "CREDIT_MEMO",
                "PRODUCT",
                "CONTRACT",
                "VENDOR",
                "BILL",
                "PURCHASE_ORDER",
                "JOURNAL_ENTRY",
                "CUSTOM_OBJECT",
                "LINE"
              ]
            }
          },
          {
            "name": "objectKey",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,39}$"
            }
          },
          {
            "name": "includeArchived",
            "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/CreateCustomFieldDefinitionResponse"
                      }
                    },
                    "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": "createCustomFieldDefinition",
        "summary": "Defines a custom field for a kind of record.",
        "description": "Defines a custom field for a kind of record. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recordKind": {
                    "type": "string",
                    "enum": [
                      "CUSTOMER",
                      "INVOICE",
                      "CREDIT_MEMO",
                      "PRODUCT",
                      "CONTRACT",
                      "VENDOR",
                      "BILL",
                      "PURCHASE_ORDER",
                      "JOURNAL_ENTRY",
                      "CUSTOM_OBJECT",
                      "LINE"
                    ]
                  },
                  "key": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,39}$"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "TEXT",
                      "NUMBER",
                      "DATE",
                      "CHOICE",
                      "CHECKBOX",
                      "MONEY",
                      "MULTI_CHOICE",
                      "REFERENCE"
                    ]
                  },
                  "choices": {
                    "$ref": "#/components/schemas/Choices2"
                  },
                  "required": {
                    "default": false,
                    "type": "boolean"
                  },
                  "showOnDocument": {
                    "default": false,
                    "type": "boolean"
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "appliesTo": {
                    "$ref": "#/components/schemas/AppliesTo2"
                  },
                  "objectKey": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,39}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "reference": {
                    "type": "object",
                    "properties": {
                      "target": {
                        "type": "string",
                        "enum": [
                          "CUSTOMER",
                          "VENDOR",
                          "PRODUCT",
                          "CONTRACT",
                          "ACCOUNT",
                          "ENTITY",
                          "PERSON",
                          "DIMENSION_VALUE",
                          "CUSTOM_RECORD"
                        ]
                      },
                      "objectKey": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,39}$"
                      },
                      "dimensionCode": {
                        "type": "string",
                        "pattern": "^[A-Z][A-Z0-9_]{1,29}$"
                      }
                    },
                    "required": [
                      "target"
                    ],
                    "additionalProperties": false
                  },
                  "indexed": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "recordKind",
                  "key",
                  "label",
                  "type"
                ],
                "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/CreateCustomFieldDefinitionResponse"
                }
              }
            }
          },
          "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/custom-fields/{definitionId}": {
      "patch": {
        "operationId": "updateCustomFieldDefinition",
        "summary": "Changes the definition of a custom field.",
        "description": "Changes the definition of a custom field. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "definitionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "choices": {
                    "$ref": "#/components/schemas/Choices2"
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "showOnDocument": {
                    "type": "boolean"
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000
                  },
                  "indexed": {
                    "type": "boolean"
                  },
                  "appliesTo": {
                    "$ref": "#/components/schemas/AppliesTo2"
                  }
                },
                "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/CreateCustomFieldDefinitionResponse"
                }
              }
            }
          },
          "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"
          },
          "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/custom-fields/{definitionId}/archive": {
      "post": {
        "operationId": "archiveCustomFieldDefinition",
        "summary": "Archives a custom field so it is no longer offered on records.",
        "description": "Archives a custom field so it is no longer offered on records. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "definitionId",
            "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"
                    },
                    "recordKind": {
                      "type": "string",
                      "enum": [
                        "CUSTOMER",
                        "INVOICE",
                        "CREDIT_MEMO",
                        "PRODUCT",
                        "CONTRACT",
                        "VENDOR",
                        "BILL",
                        "PURCHASE_ORDER",
                        "JOURNAL_ENTRY",
                        "CUSTOM_OBJECT",
                        "LINE"
                      ]
                    },
                    "objectKey": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "key": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "TEXT",
                        "NUMBER",
                        "DATE",
                        "CHOICE",
                        "CHECKBOX",
                        "MONEY",
                        "MULTI_CHOICE",
                        "REFERENCE"
                      ]
                    },
                    "choices": {
                      "$ref": "#/components/schemas/Choices"
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reference": {
                      "$ref": "#/components/schemas/Reference"
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "showOnDocument": {
                      "type": "boolean"
                    },
                    "indexed": {
                      "type": "boolean"
                    },
                    "indexState": {
                      "type": "string",
                      "enum": [
                        "OFF",
                        "BUILDING",
                        "READY"
                      ]
                    },
                    "indexJobId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "appliesTo": {
                      "$ref": "#/components/schemas/AppliesTo"
                    },
                    "position": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "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"
                        }
                      ]
                    },
                    "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
                    },
                    "affectedRules": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "id",
                    "recordKind",
                    "objectKey",
                    "key",
                    "label",
                    "description",
                    "type",
                    "choices",
                    "currency",
                    "reference",
                    "required",
                    "showOnDocument",
                    "indexed",
                    "appliesTo",
                    "position",
                    "archivedAt",
                    "archivedBy",
                    "createdBy",
                    "createdAt",
                    "updatedBy",
                    "updatedAt",
                    "affectedRules"
                  ],
                  "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/custom-fields/{definitionId}/restore": {
      "post": {
        "operationId": "restoreCustomFieldDefinition",
        "summary": "Restores an archived custom field.",
        "description": "Restores an archived custom field. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "definitionId",
            "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/CreateCustomFieldDefinitionResponse"
                }
              }
            }
          },
          "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/custom-objects": {
      "get": {
        "operationId": "listCustomObjectTypes",
        "summary": "Lists the custom objects the ledger defines, such as projects, with how many fields and records each has.",
        "description": "Lists the custom objects the ledger defines, such as projects, with how many fields and records each has. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListCustomObjectTypesResponseItem"
                      }
                    },
                    "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": "createCustomObjectType",
        "summary": "Defines a custom object for the ledger, such as a project, with a key that never changes.",
        "description": "Defines a custom object for the ledger, such as a project, with a key that never changes. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,39}$"
                  },
                  "singularLabel": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "pluralLabel": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "numberPrefix": {
                    "type": "string",
                    "pattern": "^[A-Z][A-Z0-9-]{0,9}$"
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000
                  }
                },
                "required": [
                  "key",
                  "singularLabel",
                  "pluralLabel"
                ],
                "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/ListCustomObjectTypesResponseItem"
                }
              }
            }
          },
          "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/custom-objects/{objectKey}": {
      "get": {
        "operationId": "getCustomObjectType",
        "summary": "Returns one custom object the ledger defines, by its key.",
        "description": "Returns one custom object the ledger defines, by its key. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "objectKey",
            "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/ListCustomObjectTypesResponseItem"
                }
              }
            }
          },
          "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": "updateCustomObjectType",
        "summary": "Changes the labels, description, number prefix or position of a custom object.",
        "description": "Changes the labels, description, number prefix or position of a custom object. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "objectKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "singularLabel": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "pluralLabel": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "numberPrefix": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z][A-Z0-9-]{0,9}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 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/ListCustomObjectTypesResponseItem"
                }
              }
            }
          },
          "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/custom-objects/{objectKey}/archive": {
      "post": {
        "operationId": "archiveCustomObjectType",
        "summary": "Archives a custom object so no record of it can be added, keeping its records.",
        "description": "Archives a custom object so no record of it can be added, keeping its records. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "objectKey",
            "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/ListCustomObjectTypesResponseItem"
                }
              }
            }
          },
          "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/custom-objects/{objectKey}/records": {
      "get": {
        "operationId": "listCustomRecords",
        "summary": "Lists the records of one custom object, filtered on its fields and sorted on an indexed field.",
        "description": "Lists the records of one custom object, filtered on its fields and sorted on an indexed field. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "objectKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "cf",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 4000
            }
          },
          {
            "name": "range",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 4000
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(name|number|createdAt|cf\\.[a-z][a-z0-9_]{0,39})$"
            }
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "archived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "include",
                "only"
              ]
            }
          },
          {
            "name": "linkedTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z_]+(:[a-z][a-z0-9_]{0,39})?:[^:\\s]{1,100}$"
            }
          }
        ],
        "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/ListCustomRecordsResponseItem"
                      }
                    },
                    "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": "createCustomRecord",
        "summary": "Creates a record of a custom object, such as a project.",
        "description": "Creates a record of a custom object, such as a project. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "objectKey",
            "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": 200
                  },
                  "values": {
                    "$ref": "#/components/schemas/CustomFields"
                  }
                },
                "required": [
                  "name"
                ],
                "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/ListCustomRecordsResponseItem"
                }
              }
            }
          },
          "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/custom-objects/{objectKey}/records/{recordId}": {
      "get": {
        "operationId": "getCustomRecord",
        "summary": "Returns one record of a custom object.",
        "description": "Returns one record of a custom object. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "objectKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "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/ListCustomRecordsResponseItem"
                }
              }
            }
          },
          "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": "updateCustomRecord",
        "summary": "Changes a custom object record's name or values. Send only changed values: null clears one, one left out is kept.",
        "description": "Changes a custom object record's name or values. Send only changed values: null clears one, one left out is kept. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "objectKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "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": 200
                  },
                  "values": {
                    "$ref": "#/components/schemas/CustomFields6"
                  },
                  "ifRevision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "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/ListCustomRecordsResponseItem"
                }
              }
            }
          },
          "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/custom-objects/{objectKey}/records/{recordId}/archive": {
      "post": {
        "operationId": "archiveCustomRecord",
        "summary": "Archives a custom object record, keeping it so it can be restored.",
        "description": "Archives a custom object record, keeping it so it can be restored. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "objectKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "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/ListCustomRecordsResponseItem"
                }
              }
            }
          },
          "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/custom-objects/{objectKey}/records/{recordId}/restore": {
      "post": {
        "operationId": "restoreCustomRecord",
        "summary": "Restores an archived custom object record.",
        "description": "Restores an archived custom object record. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "objectKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "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/ListCustomRecordsResponseItem"
                }
              }
            }
          },
          "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/custom-objects/{objectKey}/restore": {
      "post": {
        "operationId": "restoreCustomObjectType",
        "summary": "Restores an archived custom object.",
        "description": "Restores an archived custom object. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "objectKey",
            "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/ListCustomObjectTypesResponseItem"
                }
              }
            }
          },
          "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": {
      "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/customisation": {
      "get": {
        "operationId": "getCustomisation",
        "summary": "Returns the version of the ledger's customisation and how many custom objects, fields, line fields, rules and dimensions it holds.",
        "description": "Returns the version of the ledger's customisation and how many custom objects, fields, line fields, rules and dimensions it holds. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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": {
                    "ledgerId": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "changedAt": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "counts": {
                      "$ref": "#/components/schemas/Counts"
                    },
                    "fieldCounts": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "enum": [
                          "CUSTOMER",
                          "INVOICE",
                          "CREDIT_MEMO",
                          "PRODUCT",
                          "CONTRACT",
                          "VENDOR",
                          "BILL",
                          "PURCHASE_ORDER",
                          "JOURNAL_ENTRY",
                          "CUSTOM_OBJECT",
                          "LINE"
                        ]
                      },
                      "additionalProperties": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "lineFieldCounts": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "enum": [
                          "PURCHASE_ORDER_LINE",
                          "GOODS_RECEIPT_LINE",
                          "BILL_LINE",
                          "VENDOR_CREDIT_LINE",
                          "INVOICE_LINE",
                          "CREDIT_MEMO_LINE",
                          "JOURNAL_LINE"
                        ]
                      },
                      "additionalProperties": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    }
                  },
                  "required": [
                    "ledgerId",
                    "version",
                    "changedAt",
                    "counts",
                    "fieldCounts",
                    "lineFieldCounts"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/customisation/catalogue": {
      "get": {
        "operationId": "getCustomisationCatalogue",
        "summary": "Returns everything the ledger customised: its custom objects with their operations, and the schema of each customised record and line.",
        "description": "Returns everything the ledger customised: its custom objects with their operations, and the schema of each customised record and line. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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": {
                    "ledgerId": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "complete": {
                      "type": "boolean",
                      "const": true
                    },
                    "operations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "pattern": "^custom\\.[a-z][a-z0-9_]{0,39}\\.(list|get|create|update|archive|restore)$"
                          },
                          "base": {
                            "type": "string"
                          },
                          "params": {
                            "type": "object",
                            "properties": {
                              "objectKey": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "objectKey"
                            ],
                            "additionalProperties": false
                          },
                          "summary": {
                            "type": "string"
                          },
                          "effectClass": {
                            "type": "string",
                            "enum": [
                              "read",
                              "write",
                              "delete",
                              "money-out",
                              "banking",
                              "cra-filing"
                            ]
                          },
                          "input": {
                            "$ref": "#/components/schemas/Input"
                          },
                          "query": {
                            "$ref": "#/components/schemas/Input"
                          },
                          "output": {
                            "$ref": "#/components/schemas/InputOption1"
                          },
                          "since": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "name",
                          "base",
                          "params",
                          "summary",
                          "effectClass",
                          "input",
                          "query",
                          "output",
                          "since"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "customFields": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "enum": [
                          "CUSTOMER",
                          "INVOICE",
                          "CREDIT_MEMO",
                          "PRODUCT",
                          "CONTRACT",
                          "VENDOR",
                          "BILL",
                          "PURCHASE_ORDER",
                          "JOURNAL_ENTRY",
                          "CUSTOM_OBJECT",
                          "LINE"
                        ]
                      },
                      "additionalProperties": {
                        "$ref": "#/components/schemas/InputOption1"
                      }
                    },
                    "lineFields": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "enum": [
                          "PURCHASE_ORDER_LINE",
                          "GOODS_RECEIPT_LINE",
                          "BILL_LINE",
                          "VENDOR_CREDIT_LINE",
                          "INVOICE_LINE",
                          "CREDIT_MEMO_LINE",
                          "JOURNAL_LINE"
                        ]
                      },
                      "additionalProperties": {
                        "$ref": "#/components/schemas/InputOption1"
                      }
                    },
                    "dimensions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "label"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "counts": {
                      "$ref": "#/components/schemas/Counts"
                    }
                  },
                  "required": [
                    "ledgerId",
                    "version",
                    "complete",
                    "operations",
                    "customFields",
                    "lineFields",
                    "dimensions",
                    "counts"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/cutovers": {
      "get": {
        "operationId": "listCutovers",
        "summary": "Lists the cutovers that move a company onto this ledger.",
        "description": "Lists the cutovers that move a company onto this ledger. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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": [
                "OPEN",
                "SETTLED",
                "WITHDRAWN"
              ]
            }
          },
          {
            "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": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "conversionDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "previousSystem": {
                            "type": "string",
                            "enum": [
                              "QUICKBOOKS_ONLINE",
                              "QUICKBOOKS_DESKTOP",
                              "XERO",
                              "SAGE_50",
                              "SPREADSHEET",
                              "OTHER"
                            ]
                          },
                          "previousSystemLabel": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "previousSystemName": {
                            "type": "string"
                          },
                          "suspenseAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "OPEN",
                              "SETTLED",
                              "WITHDRAWN"
                            ]
                          },
                          "openedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "openedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "settledBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "settledAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "conversionDate",
                          "previousSystem",
                          "previousSystemLabel",
                          "previousSystemName",
                          "suspenseAccount",
                          "state",
                          "openedBy",
                          "openedAt",
                          "settledBy",
                          "settledAt"
                        ],
                        "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": "openCutover",
        "summary": "Opens a cutover that moves a company's opening balances onto this ledger.",
        "description": "Opens a cutover that moves a company's opening balances onto this ledger. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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
                  },
                  "conversionDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "previousSystem": {
                    "type": "string",
                    "enum": [
                      "QUICKBOOKS_ONLINE",
                      "QUICKBOOKS_DESKTOP",
                      "XERO",
                      "SAGE_50",
                      "SPREADSHEET",
                      "OTHER"
                    ]
                  },
                  "previousSystemLabel": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "suspenseAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "itcClaimedInPreviousSystem": {
                    "default": true,
                    "type": "boolean"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "entityId",
                  "conversionDate",
                  "previousSystem",
                  "suspenseAccountId"
                ],
                "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/GetCutoverResponse"
                }
              }
            }
          },
          "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/cutovers/{cutoverId}": {
      "get": {
        "operationId": "getCutover",
        "summary": "Returns one cutover with its steps and its status.",
        "description": "Returns one cutover with its steps and its status. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "cutoverId",
            "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/GetCutoverResponse"
                }
              }
            }
          },
          "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": "updateCutover",
        "summary": "Changes the details of an open cutover.",
        "description": "Changes the details of an open cutover. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "cutoverId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "conversionDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "previousSystem": {
                    "type": "string",
                    "enum": [
                      "QUICKBOOKS_ONLINE",
                      "QUICKBOOKS_DESKTOP",
                      "XERO",
                      "SAGE_50",
                      "SPREADSHEET",
                      "OTHER"
                    ]
                  },
                  "previousSystemLabel": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "suspenseAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "itcClaimedInPreviousSystem": {
                    "type": "boolean"
                  },
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "openingEntryId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "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/GetCutoverResponse"
                }
              }
            }
          },
          "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/cutovers/{cutoverId}/brief": {
      "post": {
        "operationId": "draftCutoverBrief",
        "summary": "Drafts the brief that explains a cutover to the people who sign it off.",
        "description": "Drafts the brief that explains a cutover to the people who sign it off. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "cutoverId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "checksDigest": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{16}$"
                  },
                  "checksReadAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "facts": {
                    "type": "object",
                    "properties": {
                      "checks": {
                        "minItems": 7,
                        "maxItems": 7,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "check": {
                              "type": "string",
                              "enum": [
                                "CHART",
                                "OPENING_TRIAL_BALANCE",
                                "VENDORS",
                                "PAYABLES_TIE",
                                "SUSPENSE_NIL",
                                "BANKING",
                                "PERIODS_LOCKED"
                              ]
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "PASSED",
                                "FAILED",
                                "NOT_READ"
                              ]
                            },
                            "count": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 1000000
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "cause": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "NO_IMPORT",
                                    "WAITING_FOR_APPROVAL",
                                    "NO_ACTIVE_ACCOUNTS",
                                    "NOT_NAMED",
                                    "NOT_POSTED",
                                    "WRONG_DATE",
                                    "UNBALANCED",
                                    "NO_APPLIED_IMPORT",
                                    "UNEXPLAINED",
                                    "RESIDUAL",
                                    "NOT_READ_TOO_MANY_BILLS",
                                    "DEBIT_LEFT",
                                    "CREDIT_LEFT",
                                    "IN_PAYABLE_SET",
                                    "UNVERIFIED",
                                    "WAITING_FOR_SECOND_PERSON",
                                    "TOO_MANY",
                                    "GL_NOT_LOCKED",
                                    "AP_NOT_LOCKED",
                                    "BOTH"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "check",
                            "state",
                            "count",
                            "cause"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "tie": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "direction": {
                                "type": "string",
                                "enum": [
                                  "CONTROL_HIGHER",
                                  "CONTROL_LOWER",
                                  "EQUAL"
                                ]
                              },
                              "unexplained": {
                                "maxItems": 6,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "enum": [
                                    "ADDED_BY_JOURNAL",
                                    "TAKEN_OFF_BY_JOURNAL",
                                    "OPENING_BALANCE",
                                    "IMPORTED",
                                    "REVERSED_PAIRS",
                                    "OTHER_SOURCE"
                                  ]
                                }
                              },
                              "residual": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "direction",
                              "unexplained",
                              "residual"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "suspense": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "side": {
                                "type": "string",
                                "enum": [
                                  "DEBIT",
                                  "CREDIT",
                                  "NIL"
                                ]
                              },
                              "pendingEntries": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 100000
                              },
                              "inPayableSet": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "side",
                              "pendingEntries",
                              "inPayableSet"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "opening": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "named": {
                                "type": "boolean"
                              },
                              "posted": {
                                "type": "boolean"
                              },
                              "datedOnConversion": {
                                "type": "boolean"
                              },
                              "carriesPayableLine": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "named",
                              "posted",
                              "datedOnConversion",
                              "carriesPayableLine"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "previousSystem": {
                        "type": "string",
                        "enum": [
                          "QUICKBOOKS_ONLINE",
                          "QUICKBOOKS_DESKTOP",
                          "XERO",
                          "SAGE_50",
                          "SPREADSHEET",
                          "OTHER"
                        ]
                      },
                      "itcClaimedInPreviousSystem": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "checks",
                      "tie",
                      "suspense",
                      "opening",
                      "previousSystem",
                      "itcClaimedInPreviousSystem"
                    ],
                    "additionalProperties": false
                  },
                  "figures": {
                    "type": "object",
                    "properties": {
                      "currency": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      "suspenseMinor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "controlMinor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "subledgerMinor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "unexplainedMinor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "counts": {
                        "maxItems": 7,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "check": {
                              "type": "string",
                              "enum": [
                                "CHART",
                                "OPENING_TRIAL_BALANCE",
                                "VENDORS",
                                "PAYABLES_TIE",
                                "SUSPENSE_NIL",
                                "BANKING",
                                "PERIODS_LOCKED"
                              ]
                            },
                            "count": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "check",
                            "count"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "currency",
                      "suspenseMinor",
                      "controlMinor",
                      "subledgerMinor",
                      "unexplainedMinor",
                      "counts"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "checksDigest",
                  "checksReadAt",
                  "facts",
                  "figures"
                ],
                "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": {
                    "cutoverId": {
                      "type": "string"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "PROVIDER",
                            "DISCLOSURE",
                            "BUDGET",
                            "LIMIT",
                            "UNPARSABLE",
                            "REFUSED",
                            "FIGURE_INVENTED",
                            "ORDER_INVALID",
                            "NOTHING_LEFT"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "whyDetail": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "summary": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "order": {
                      "anyOf": [
                        {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "CHART",
                              "OPENING_TRIAL_BALANCE",
                              "VENDORS",
                              "PAYABLES_TIE",
                              "SUSPENSE_NIL",
                              "BANKING",
                              "PERIODS_LOCKED"
                            ]
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "steps": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "check": {
                            "type": "string",
                            "enum": [
                              "CHART",
                              "OPENING_TRIAL_BALANCE",
                              "VENDORS",
                              "PAYABLES_TIE",
                              "SUSPENSE_NIL",
                              "BANKING",
                              "PERIODS_LOCKED"
                            ]
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "check",
                          "text"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "checksDigest": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{16}$"
                    },
                    "checksReadAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "promptVersion": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "explainedAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "cutoverId",
                    "entityTimeZone",
                    "why",
                    "whyDetail",
                    "summary",
                    "order",
                    "steps",
                    "checksDigest",
                    "checksReadAt",
                    "promptVersion",
                    "explainedAt"
                  ],
                  "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/cutovers/{cutoverId}/migration-readings": {
      "get": {
        "operationId": "listMigrationReadings",
        "summary": "Lists the migration readings taken during a cutover.",
        "description": "Lists the migration readings taken during a cutover. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "cutoverId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "SUPPLIER_LISTS",
                "OPEN_PAYABLES",
                "BANKING_FILE",
                "FIRST_MONTH"
              ]
            }
          },
          {
            "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/ListMigrationReadingsResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "bankingWithheld": {
                      "type": "boolean"
                    }
                  },
                  "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": "makeMigrationReading",
        "summary": "Takes a migration reading of a cutover, comparing the ledger with the old system.",
        "description": "Takes a migration reading of a cutover, comparing the ledger with the old system. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "cutoverId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "SUPPLIER_LISTS"
                      },
                      "leftImportIds": {
                        "minItems": 1,
                        "maxItems": 5,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "leftImportIds"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "BANKING_FILE"
                      },
                      "leftImportIds": {
                        "minItems": 1,
                        "maxItems": 5,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "leftImportIds"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "OPEN_PAYABLES"
                      },
                      "reportTotalMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "trialBalancePayableMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      }
                    },
                    "required": [
                      "kind"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "FIRST_MONTH"
                      },
                      "monthId": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "kind",
                      "monthId"
                    ],
                    "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/ListMigrationReadingsResponseItem"
                }
              }
            }
          },
          "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/cutovers/{cutoverId}/payables": {
      "get": {
        "operationId": "listCutoverPayables",
        "summary": "Lists the open payables carried into the ledger by a cutover.",
        "description": "Lists the open payables carried into the ledger by a cutover. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "cutoverId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "importId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 30
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "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": {
                          "billId": {
                            "type": "string"
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "number": {
                            "type": "string"
                          },
                          "billDate": {
                            "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+$"
                          },
                          "functionalTotalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "openMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "status": {
                            "type": "string"
                          },
                          "entryId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entryNumber": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "importId": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "billId",
                          "vendor",
                          "number",
                          "billDate",
                          "dueDate",
                          "currency",
                          "totalMinor",
                          "functionalTotalMinor",
                          "openMinor",
                          "status",
                          "entryId",
                          "entryNumber",
                          "importId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "summary": {
                      "type": "object",
                      "properties": {
                        "entityTimeZone": {
                          "type": "string"
                        },
                        "count": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "vendors": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "totals": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "billedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "openMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              }
                            },
                            "required": [
                              "currency",
                              "billedMinor",
                              "openMinor"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "functionalCurrency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "functionalTotalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "suspenseDebitMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "tiedOut": {
                          "type": "boolean"
                        },
                        "postings": {
                          "maxItems": 20,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "importId": {
                                "type": "string"
                              },
                              "fileName": {
                                "type": "string"
                              },
                              "postedBy": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              "postedAt": {
                                "type": "string",
                                "minLength": 20
                              },
                              "count": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "functionalTotalMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "controlTotalMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "controlNote": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "reversed": {
                                "type": "boolean"
                              },
                              "canReverse": {
                                "type": "boolean"
                              },
                              "reverseBlockers": {
                                "maxItems": 5,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "billId": {
                                      "type": "string"
                                    },
                                    "number": {
                                      "type": "string"
                                    },
                                    "why": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "billId",
                                    "number",
                                    "why"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "importId",
                              "fileName",
                              "postedBy",
                              "postedAt",
                              "count",
                              "functionalTotalMinor",
                              "controlTotalMinor",
                              "controlNote",
                              "reversed",
                              "canReverse",
                              "reverseBlockers"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "postingsTotal": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "entityTimeZone",
                        "count",
                        "vendors",
                        "totals",
                        "functionalCurrency",
                        "functionalTotalMinor",
                        "suspenseDebitMinor",
                        "tiedOut",
                        "postings",
                        "postingsTotal"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "summary"
                  ],
                  "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/cutovers/{cutoverId}/payables/reverse": {
      "post": {
        "operationId": "reverseCutoverPayables",
        "summary": "Reverses the open payables a cutover carried in, so they can be re-entered.",
        "description": "Reverses the open payables a cutover carried in, so they can be re-entered. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "cutoverId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "importId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "expectedCount": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "importId",
                  "expectedCount",
                  "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": {
                    "importId": {
                      "type": "string"
                    },
                    "voided": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "reversalEntries": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "importId",
                    "voided",
                    "reversalEntries"
                  ],
                  "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/cutovers/{cutoverId}/settle": {
      "post": {
        "operationId": "settleCutover",
        "summary": "Settles a cutover, which posts its opening balances to the ledger.",
        "description": "Settles a cutover, which posts its opening balances to the ledger. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "cutoverId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "checksDigest": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{16}$"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "acknowledgements": {
                    "default": [],
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "vendorId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "reason": {
                          "type": "string",
                          "minLength": 3,
                          "maxLength": 200
                        }
                      },
                      "required": [
                        "vendorId",
                        "reason"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "checksDigest"
                ],
                "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/GetCutoverResponse"
                }
              }
            }
          },
          "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/cutovers/{cutoverId}/withdraw": {
      "post": {
        "operationId": "withdrawCutover",
        "summary": "Takes back an open cutover with nothing posted on it and returns the company to the go-live date it had before.",
        "description": "Takes back an open cutover with nothing posted on it and returns the company to the go-live date it had before. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "cutoverId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "conversionDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "goLiveDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "conversionDate",
                  "goLiveDate"
                ],
                "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/GetCutoverResponse"
                }
              }
            }
          },
          "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/dimensions": {
      "get": {
        "operationId": "listDimensions",
        "summary": "Lists the dimension types the ledger tracks, such as department or project.",
        "description": "Lists the dimension types the ledger tracks, such as department or project. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "accountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "includeArchived",
            "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": {
                    "types": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "isSystem": {
                            "type": "boolean"
                          },
                          "active": {
                            "type": "boolean"
                          },
                          "sortOrder": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "values": {
                            "$ref": "#/components/schemas/Values"
                          },
                          "valueCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "valuesNextCursor": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "code",
                          "label",
                          "description",
                          "isSystem",
                          "active",
                          "sortOrder",
                          "values",
                          "valueCount",
                          "valuesNextCursor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "accountPolicies": {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "accountId": {
                                "type": "string"
                              },
                              "dimensionTypeId": {
                                "type": "string"
                              },
                              "policy": {
                                "type": "string",
                                "enum": [
                                  "REQUIRED",
                                  "OPTIONAL",
                                  "FORBIDDEN"
                                ]
                              }
                            },
                            "required": [
                              "accountId",
                              "dimensionTypeId",
                              "policy"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "data",
                        "nextCursor",
                        "total"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "types",
                    "accountPolicies"
                  ],
                  "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/dimensions/types": {
      "post": {
        "operationId": "createDimensionType",
        "summary": "Creates a dimension, such as Channel, that lines can be tagged with.",
        "description": "Creates a dimension, such as Channel, that lines can be tagged with. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "pattern": "^[A-Z][A-Z0-9_]{1,29}$"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000
                  }
                },
                "required": [
                  "code",
                  "label"
                ],
                "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/CreateDimensionTypeResponse"
                }
              }
            }
          },
          "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/dimensions/types/{typeId}": {
      "patch": {
        "operationId": "updateDimensionType",
        "summary": "Changes the label, description or order of a dimension.",
        "description": "Changes the label, description or order of a dimension. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "typeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 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/CreateDimensionTypeResponse"
                }
              }
            }
          },
          "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/dimensions/types/{typeId}/archive": {
      "post": {
        "operationId": "archiveDimensionType",
        "summary": "Archives a dimension so lines are no longer tagged with it, keeping what is already tagged.",
        "description": "Archives a dimension so lines are no longer tagged with it, keeping what is already tagged. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "typeId",
            "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/CreateDimensionTypeResponse"
                }
              }
            }
          },
          "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/dimensions/types/{typeId}/restore": {
      "post": {
        "operationId": "restoreDimensionType",
        "summary": "Restores an archived dimension.",
        "description": "Restores an archived dimension. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "typeId",
            "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/CreateDimensionTypeResponse"
                }
              }
            }
          },
          "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/dimensions/values": {
      "post": {
        "operationId": "createDimensionValue",
        "summary": "Creates one value under a dimension type, such as a department.",
        "description": "Creates one value under a dimension type, such as a department. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "dimensionTypeId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "code": {
                    "type": "string",
                    "pattern": "^[0-9A-Za-z._-]{1,20}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "parentId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "dimensionTypeId",
                  "code",
                  "name"
                ],
                "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/ValuesItem"
                }
              }
            }
          },
          "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/dimensions/values/{valueId}": {
      "patch": {
        "operationId": "updateDimensionValue",
        "summary": "Changes the name, parent or availability of a dimension value.",
        "description": "Changes the name, parent or availability of a dimension value. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "valueId",
            "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": 120
                  },
                  "parentId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "active": {
                    "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": {
                  "$ref": "#/components/schemas/ValuesItem"
                }
              }
            }
          },
          "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/dimensions/values/{valueId}/merge": {
      "post": {
        "operationId": "mergeDimensionValue",
        "summary": "Merges one dimension value into another of the same type so reports roll it into the survivor.",
        "description": "Merges one dimension value into another of the same type so reports roll it into the survivor. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "valueId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "intoValueId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "intoValueId"
                ],
                "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/MergeDimensionValueResponse"
                }
              }
            }
          },
          "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/dimensions/values/{valueId}/unmerge": {
      "post": {
        "operationId": "unmergeDimensionValue",
        "summary": "Undoes the merge of a dimension value so it stands on its own again in reports.",
        "description": "Undoes the merge of a dimension value so it stands on its own again in reports. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "valueId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "repointedValueIds": {
                    "default": [],
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "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/MergeDimensionValueResponse"
                }
              }
            }
          },
          "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/dimensions/{typeId}/merged-values": {
      "get": {
        "operationId": "listMergedDimensionValues",
        "summary": "Lists the values of one dimension type that are merged into another, with the value each is shown as.",
        "description": "Lists the values of one dimension type that are merged into another, with the value each is shown as. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "typeId",
            "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"
                          },
                          "name": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "mergedIntoId": {
                            "type": "string"
                          },
                          "mergedIntoName": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "code",
                          "mergedIntoId",
                          "mergedIntoName"
                        ],
                        "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/dimensions/{typeId}/values": {
      "get": {
        "operationId": "listDimensionValues",
        "summary": "Lists the values of one dimension type.",
        "description": "Lists the values of one dimension type. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "typeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 120
            }
          },
          {
            "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/Values"
                    },
                    "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/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/document-search": {
      "post": {
        "operationId": "searchDocuments",
        "summary": "Finds passages in the ledger's documents, emails, record text and guides, each cited by document, page and span.",
        "description": "Finds passages in the ledger's documents, emails, record text and guides, each cited by document, page and span. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:read",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "limit": {
                    "default": 10,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 20
                  },
                  "atLeast": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "candidates": {
                    "type": "integer",
                    "minimum": 100,
                    "maximum": 150
                  },
                  "filters": {
                    "type": "object",
                    "properties": {
                      "sourceKinds": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "document",
                            "inbound-email",
                            "record",
                            "guide"
                          ]
                        }
                      },
                      "documentKinds": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/Kind7"
                        }
                      },
                      "documentIds": {
                        "minItems": 1,
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "recordTypes": {
                        "minItems": 1,
                        "maxItems": 20,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "vendorId": {
                        "type": "string"
                      },
                      "customerId": {
                        "type": "string"
                      },
                      "dateFrom": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "dateTo": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "languages": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "en",
                            "fr"
                          ]
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "query"
                ],
                "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": {
                    "passages": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassagesItem"
                      }
                    },
                    "capped": {
                      "type": "boolean",
                      "const": true
                    },
                    "limit": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "confident": {
                      "type": "boolean"
                    },
                    "meaningSearch": {
                      "type": "string",
                      "enum": [
                        "on",
                        "off"
                      ]
                    },
                    "reranked": {
                      "type": "boolean"
                    },
                    "guardrail": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "erasure_request"
                            },
                            "message": {
                              "type": "string"
                            },
                            "address": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "kind",
                            "message",
                            "address"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "asOf": {
                      "type": "object",
                      "properties": {
                        "position": {
                          "type": "string",
                          "pattern": "^(0|[1-9]\\d{0,18})$"
                        },
                        "ledgerPosition": {
                          "type": "string",
                          "pattern": "^(0|[1-9]\\d{0,18})$"
                        },
                        "freshness": {
                          "type": "string",
                          "enum": [
                            "current",
                            "behind",
                            "held"
                          ]
                        },
                        "waitingSources": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "waiting": {
                          "maxItems": 5,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "sourceId": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "sourceId",
                              "title"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "position",
                        "ledgerPosition",
                        "freshness",
                        "waitingSources",
                        "waiting"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "passages",
                    "capped",
                    "limit",
                    "confident",
                    "meaningSearch",
                    "reranked",
                    "guardrail",
                    "asOf"
                  ],
                  "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/document-search/documents/{documentId}": {
      "get": {
        "operationId": "getSearchSourceForDocument",
        "summary": "Says whether a document is ready to search, still being prepared, or could not be read, and why.",
        "description": "Says whether a document is ready to search, still being prepared, or could not be read, and why. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "documentId",
            "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/GetSearchSourceForDocumentResponse"
                }
              }
            }
          },
          "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/document-search/passages/{chunkId}": {
      "get": {
        "operationId": "getSearchPassage",
        "summary": "Reads one search passage with the rest of its section, for a clause that needs its context.",
        "description": "Reads one search passage with the rest of its section, for a clause that needs its context. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "chunkId",
            "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": {
                    "passage": {
                      "$ref": "#/components/schemas/PassagesItem"
                    },
                    "section": {
                      "maxItems": 30,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PassagesItem"
                      }
                    }
                  },
                  "required": [
                    "passage",
                    "section"
                  ],
                  "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/document-search/sources": {
      "get": {
        "operationId": "listSearchSources",
        "summary": "Lists the sources prepared for search, with their status and, for one that could not be read, why.",
        "description": "Lists the sources prepared for search, with their status and, for one that could not be read, why. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "preparing",
                "indexed",
                "not-indexed",
                "failed",
                "erased"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "document",
                "inbound-email",
                "record",
                "guide"
              ]
            }
          }
        ],
        "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/GetSearchSourceForDocumentResponse"
                      }
                    },
                    "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/document-search/sources/{sourceId}/reindex": {
      "post": {
        "operationId": "reindexSearchSource",
        "summary": "Sends a document that could not be read back to be prepared for search again.",
        "description": "Sends a document that could not be read back to be prepared for search again. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "sourceId",
            "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/GetSearchSourceForDocumentResponse"
                }
              }
            }
          },
          "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/document-search/sources/{sourceId}/text": {
      "get": {
        "operationId": "getSearchSourceText",
        "summary": "Reads every chunk of one indexed source in order, up to sixty thousand characters, as text to read and never to follow.",
        "description": "Reads every chunk of one indexed source in order, up to sixty thousand characters, as text to read and never to follow. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "sourceId",
            "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": {
                    "source": {
                      "$ref": "#/components/schemas/Source2"
                    },
                    "chunks": {
                      "maxItems": 1000,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "chunkId": {
                            "type": "string"
                          },
                          "ordinal": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "pages": {
                            "$ref": "#/components/schemas/Pages"
                          },
                          "span": {
                            "$ref": "#/components/schemas/Span"
                          },
                          "text": {
                            "type": "string",
                            "maxLength": 2000
                          }
                        },
                        "required": [
                          "chunkId",
                          "ordinal",
                          "pages",
                          "span",
                          "text"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "truncated": {
                      "type": "boolean"
                    },
                    "untrusted": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "source",
                    "chunks",
                    "truncated",
                    "untrusted"
                  ],
                  "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/document-search/status": {
      "get": {
        "operationId": "getDocumentSearchStatus",
        "summary": "Returns how many sources are ready, waiting or unreadable for search, and how current the search index is.",
        "description": "Returns how many sources are ready, waiting or unreadable for search, and how current the search index is. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "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": {
                    "counts": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "enum": [
                          "queued",
                          "preparing",
                          "indexed",
                          "not-indexed",
                          "failed",
                          "erased"
                        ]
                      },
                      "additionalProperties": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "required": [
                        "queued",
                        "preparing",
                        "indexed",
                        "not-indexed",
                        "failed",
                        "erased"
                      ]
                    },
                    "stale": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "chunks": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "meaningSearch": {
                      "type": "string",
                      "enum": [
                        "on",
                        "off"
                      ]
                    },
                    "reranking": {
                      "type": "string",
                      "enum": [
                        "on",
                        "off"
                      ]
                    },
                    "embeddingModel": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "projection": {
                      "$ref": "#/components/schemas/ProjectionsItem"
                    },
                    "guides": {
                      "type": "object",
                      "properties": {
                        "indexed": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "version": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "indexed",
                        "version"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "counts",
                    "stale",
                    "chunks",
                    "meaningSearch",
                    "reranking",
                    "embeddingModel",
                    "projection",
                    "guides"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/documents": {
      "get": {
        "operationId": "listDocuments",
        "summary": "Lists the documents in the inbox, with the server's total.",
        "description": "Lists the documents in the inbox, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "EMAIL_INBOX",
                "UPLOAD",
                "CONNECTOR"
              ]
            }
          },
          {
            "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": "id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BILL",
                "SALES_INVOICE",
                "RECORD_IMPORT"
              ]
            }
          },
          {
            "name": "became",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BILL",
                "IMPORT_BATCH",
                "FLAGGED",
                "NOTHING"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "addressId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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}$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "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"
                          },
                          "sha256": {
                            "type": "string",
                            "minLength": 64,
                            "maxLength": 64
                          },
                          "fileName": {
                            "type": "string"
                          },
                          "mimeType": {
                            "type": "string"
                          },
                          "sizeBytes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "EMAIL_INBOX",
                              "UPLOAD",
                              "CONNECTOR"
                            ]
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "uploadedByName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "viaVendorPortal": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "submissionId": {
                                    "type": "string"
                                  },
                                  "vendorId": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "submissionId",
                                  "vendorId"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "extraction": {
                            "$ref": "#/components/schemas/Extraction"
                          },
                          "kind": {
                            "$ref": "#/components/schemas/Kind7"
                          },
                          "sender": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "inboundEmailId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "address": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entityId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entityName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "became": {
                            "$ref": "#/components/schemas/Became"
                          }
                        },
                        "required": [
                          "id",
                          "sha256",
                          "fileName",
                          "mimeType",
                          "sizeBytes",
                          "source",
                          "createdAt",
                          "uploadedByName",
                          "viaVendorPortal",
                          "extraction",
                          "kind",
                          "sender",
                          "inboundEmailId",
                          "address",
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "became"
                        ],
                        "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/documents/{documentId}": {
      "get": {
        "operationId": "getDocument",
        "summary": "Returns one document with its status and where it was filed.",
        "description": "Returns one document with its status and where it was filed. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "documentId",
            "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"
                    },
                    "sha256": {
                      "type": "string",
                      "minLength": 64,
                      "maxLength": 64
                    },
                    "fileName": {
                      "type": "string"
                    },
                    "mimeType": {
                      "type": "string"
                    },
                    "sizeBytes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "EMAIL_INBOX",
                        "UPLOAD",
                        "CONNECTOR"
                      ]
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "uploadedByName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "viaVendorPortal": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "submissionId": {
                              "type": "string"
                            },
                            "vendorId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "submissionId",
                            "vendorId"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "extraction": {
                      "$ref": "#/components/schemas/Extraction"
                    },
                    "kind": {
                      "$ref": "#/components/schemas/Kind7"
                    },
                    "sender": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "inboundEmailId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "address": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "entityId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "entityName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "became": {
                      "$ref": "#/components/schemas/Became"
                    },
                    "arrivals": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "inboundEmailId": {
                            "type": "string"
                          },
                          "receivedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "sender": {
                            "type": "string"
                          },
                          "address": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "inboundEmailId",
                          "receivedAt",
                          "sender",
                          "address"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "arrivalsTotal": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "evidenceLinks": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "ENTRY",
                              "BILL",
                              "INVOICE",
                              "CREDIT_MEMO",
                              "CUSTOMER"
                            ]
                          },
                          "id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind",
                          "id",
                          "label"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "evidenceTotal": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "extractionNote": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "sha256",
                    "fileName",
                    "mimeType",
                    "sizeBytes",
                    "source",
                    "createdAt",
                    "uploadedByName",
                    "viaVendorPortal",
                    "extraction",
                    "kind",
                    "sender",
                    "inboundEmailId",
                    "address",
                    "entityId",
                    "entityName",
                    "entityTimeZone",
                    "became",
                    "arrivals",
                    "arrivalsTotal",
                    "evidenceLinks",
                    "evidenceTotal",
                    "extractionNote"
                  ],
                  "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/documents/{documentId}/read-again": {
      "post": {
        "operationId": "readDocumentAgain",
        "summary": "Reads an inbox document again after it was corrected.",
        "description": "Reads an inbox document again after it was corrected. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "documentId",
            "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
                  }
                },
                "required": [
                  "proposalId"
                ],
                "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": {
                    "documentId": {
                      "type": "string"
                    },
                    "proposalId": {
                      "type": "string"
                    },
                    "attempt": {
                      "type": "integer",
                      "minimum": 2,
                      "maximum": 3
                    },
                    "queued": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "documentId",
                    "proposalId",
                    "attempt",
                    "queued"
                  ],
                  "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/entities": {
      "get": {
        "operationId": "listEntities",
        "summary": "Lists the companies (entities) on the ledger.",
        "description": "Lists the companies (entities) on the ledger. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "stable",
        "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
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "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/ListEntitiesResponseItem"
                      }
                    },
                    "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": "createEntity",
        "summary": "Creates a company (entity) on the ledger.",
        "description": "Creates a company (entity) on the ledger. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "functionalCurrency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "country": {
                    "type": "string",
                    "enum": [
                      "CA",
                      "US"
                    ]
                  },
                  "region": {
                    "type": "string",
                    "pattern": "^(CA|US)-[A-Z]{2}$"
                  },
                  "fiscalYearEndMonth": {
                    "default": 12,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "legalForm": {
                    "type": "string",
                    "enum": [
                      "CORPORATION",
                      "SOLE_PROPRIETORSHIP",
                      "PARTNERSHIP",
                      "TRUST"
                    ]
                  },
                  "timeZone": {
                    "default": "America/Toronto",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "incorporatedOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "seedCoa": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "functionalCurrency",
                  "country"
                ],
                "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": {
                  "type": "object",
                  "properties": {
                    "entity": {
                      "$ref": "#/components/schemas/ListEntitiesResponseItem"
                    },
                    "accountsCreated": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "accountsActivated": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "entity",
                    "accountsCreated",
                    "accountsActivated"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/entities/{entityId}": {
      "get": {
        "operationId": "getEntity",
        "summary": "Returns one company on the ledger with its settings.",
        "description": "Returns one company on the ledger with its settings. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "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/ListEntitiesResponseItem"
                }
              }
            }
          },
          "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": "updateEntity",
        "summary": "Changes a company's name, year end or other settings.",
        "description": "Changes a company's name, year end or other settings. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "entityId",
            "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": 120
                  },
                  "region": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^(CA|US)-[A-Z]{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "fiscalYearEndMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "timeZone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "incorporatedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "legalForm": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "CORPORATION",
                          "SOLE_PROPRIETORSHIP",
                          "PARTNERSHIP",
                          "TRUST"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "exchangeDifferenceAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "customerDepositsAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "holdbackReceivableAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "receivableAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "defaultSalesAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "invoiceTerms": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "invoiceTermsFr": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "goLiveDate": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "acknowledgeBudgetRewindow": {
                    "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": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "changed": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "entity": {
                      "$ref": "#/components/schemas/ListEntitiesResponseItem"
                    },
                    "strandedAssets": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "assets": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "assetId": {
                                "type": "string"
                              },
                              "assetName": {
                                "type": "string"
                              },
                              "inServiceOn": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "reason": {
                                "type": "string"
                              },
                              "remedy": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "assetId",
                              "assetName",
                              "inServiceOn",
                              "reason",
                              "remedy"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "total",
                        "assets"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "changed",
                    "entity"
                  ],
                  "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/entities/{entityId}/invoice-template": {
      "get": {
        "operationId": "getInvoiceTemplate",
        "summary": "Returns the invoice template a company issues invoices with.",
        "description": "Returns the invoice template a company issues invoices with. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "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/GetInvoiceTemplateResponse"
                }
              }
            }
          },
          "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": "updateInvoiceTemplate",
        "summary": "Changes the invoice template a company issues invoices with.",
        "description": "Changes the invoice template a company issues invoices with. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "entityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "showItemCode": {
                    "type": "boolean"
                  },
                  "showServicePeriod": {
                    "type": "boolean"
                  },
                  "showDiscount": {
                    "type": "boolean"
                  },
                  "showOriginAndHsCode": {
                    "type": "boolean"
                  },
                  "showCustomFields": {
                    "type": "boolean"
                  },
                  "footerNote": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "termsText": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "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/GetInvoiceTemplateResponse"
                }
              }
            }
          },
          "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/entities/{entityId}/invoice-template/logo/remove": {
      "post": {
        "operationId": "removeInvoiceLogo",
        "summary": "Removes the logo from a company's invoices.",
        "description": "Removes the logo from a company's invoices. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "entityId",
            "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/GetInvoiceTemplateResponse"
                }
              }
            }
          },
          "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/entities/{entityId}/specific-provisions": {
      "get": {
        "operationId": "listSpecificProvisions",
        "summary": "Lists the specific provisions recorded for a company.",
        "description": "Lists the specific provisions recorded for a company. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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/ListSpecificProvisionsResponseItem"
                      }
                    },
                    "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": "createSpecificProvision",
        "summary": "Records a specific provision for a company.",
        "description": "Records a specific provision for a company. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "entityId",
            "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
                  },
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 500
                  },
                  "effectiveFrom": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "effectiveTo": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "customerId",
                  "amountMinor",
                  "reason",
                  "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/ListSpecificProvisionsResponseItem"
                }
              }
            }
          },
          "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/entities/{entityId}/specific-provisions/{provisionId}": {
      "patch": {
        "operationId": "updateSpecificProvision",
        "summary": "Changes a specific provision.",
        "description": "Changes a specific provision. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "entityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "provisionId",
            "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": 3,
                    "maxLength": 500
                  },
                  "effectiveFrom": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "effectiveTo": {
                    "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/ListSpecificProvisionsResponseItem"
                }
              }
            }
          },
          "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/entities/{entityId}/specific-provisions/{provisionId}/remove": {
      "post": {
        "operationId": "removeSpecificProvision",
        "summary": "Removes a specific provision.",
        "description": "Removes a specific provision. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "entityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "provisionId",
            "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/entities/{entityId}/year-end": {
      "get": {
        "operationId": "getYearEndSettings",
        "summary": "Returns the year end settings of a company.",
        "description": "Returns the year end settings of a company. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "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/GetYearEndSettingsResponse"
                }
              }
            }
          },
          "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": "updateYearEndSettings",
        "summary": "Changes the year end settings of a company.",
        "description": "Changes the year end settings of a company. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "entityId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "allowanceMethod": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "AGEING_BUCKETS",
                          "SPECIFIC_PROVISIONS",
                          "COMBINED"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "allowanceAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "unrealizedFxAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "badDebtAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "rates": {
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/RatesItem"
                    }
                  }
                },
                "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/GetYearEndSettingsResponse"
                }
              }
            }
          },
          "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/entries": {
      "get": {
        "operationId": "listEntries",
        "summary": "Lists the journal entries on the ledger, newest first, with the server's total.",
        "description": "Lists the journal entries on the ledger, newest first, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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": [
                "DRAFT",
                "PROPOSED",
                "IN_REVIEW",
                "APPROVED",
                "POSTED",
                "DECLINED",
                "REVERSED"
              ]
            }
          },
          {
            "name": "statuses",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(DRAFT|PROPOSED|IN_REVIEW|APPROVED|POSTED|DECLINED|REVERSED)(,(DRAFT|PROPOSED|IN_REVIEW|APPROVED|POSTED|DECLINED|REVERSED))*$"
            }
          },
          {
            "name": "sourceKind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "MANUAL",
                "AGENT_PROPOSAL",
                "RECURRING",
                "REVERSAL",
                "IMPORT",
                "CHAT",
                "MIGRATION",
                "PAYMENT_RUN",
                "INVOICE",
                "RECEIPT",
                "BILL",
                "BILL_SETTLEMENT",
                "VENDOR_CREDIT"
              ]
            }
          },
          {
            "name": "accountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "scheduleId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "default": "newest",
              "type": "string",
              "enum": [
                "newest",
                "oldest"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "receiptVoids",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "grouped"
              ]
            }
          },
          {
            "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"
                          },
                          "entryNumber": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "entryRef": {
                            "type": "string"
                          },
                          "entryDate": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "PROPOSED",
                              "IN_REVIEW",
                              "APPROVED",
                              "POSTED",
                              "DECLINED",
                              "REVERSED"
                            ]
                          },
                          "sourceKind": {
                            "type": "string",
                            "enum": [
                              "MANUAL",
                              "AGENT_PROPOSAL",
                              "RECURRING",
                              "REVERSAL",
                              "IMPORT",
                              "CHAT",
                              "MIGRATION",
                              "PAYMENT_RUN",
                              "INVOICE",
                              "RECEIPT",
                              "BILL",
                              "BILL_SETTLEMENT",
                              "VENDOR_CREDIT"
                            ]
                          },
                          "memo": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "attribution": {
                            "type": "string"
                          },
                          "totalDebitMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "entryNumber",
                          "entryRef",
                          "entryDate",
                          "status",
                          "sourceKind",
                          "memo",
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "attribution",
                          "totalDebitMinor",
                          "currency"
                        ],
                        "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": "createEntry",
        "summary": "Creates a draft journal entry with its lines on the ledger.",
        "description": "Creates a draft journal entry with its lines on the ledger. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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
                  },
                  "entryDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "memo": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "postImmediately": {
                    "default": false,
                    "type": "boolean"
                  },
                  "autoReverse": {
                    "default": false,
                    "type": "boolean"
                  },
                  "reversalDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "lines": {
                    "minItems": 2,
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "accountId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "debitMajor": {
                          "default": "",
                          "type": "string"
                        },
                        "creditMajor": {
                          "default": "",
                          "type": "string"
                        },
                        "memo": {
                          "type": "string",
                          "maxLength": 500
                        },
                        "dimensions": {
                          "default": [],
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/DimensionsItem"
                          }
                        },
                        "tax": {
                          "$ref": "#/components/schemas/Tax"
                        },
                        "customFields": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9_]{0,39}$"
                          },
                          "additionalProperties": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 500
                              },
                              {
                                "type": "boolean"
                              }
                            ]
                          }
                        }
                      },
                      "required": [
                        "accountId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "tax": {
                    "$ref": "#/components/schemas/Tax2"
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields"
                  }
                },
                "required": [
                  "entityId",
                  "entryDate",
                  "currency",
                  "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/GetEntryResponse"
                }
              }
            }
          },
          "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/entries/bulk-approve": {
      "post": {
        "operationId": "bulkApprove",
        "summary": "Approves several journal entries in one request, each checked on its own.",
        "description": "Approves several journal entries in one request, each checked on its own. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entryIds": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": [
                  "entryIds"
                ],
                "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": {
                          "entryId": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "entryId",
                          "reason"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "approved",
                    "failures"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/entries/{entryId}": {
      "get": {
        "operationId": "getEntry",
        "summary": "Returns one journal entry with its lines and its status.",
        "description": "Returns one journal entry with its lines and its status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entryId",
            "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/GetEntryResponse"
                }
              }
            }
          },
          "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/entries/{entryId}/approve": {
      "post": {
        "operationId": "approveEntry",
        "summary": "Approves a submitted journal entry so that it can be posted.",
        "description": "Approves a submitted journal entry so that it can be posted. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "entryId",
            "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/GetEntryResponse"
                }
              }
            }
          },
          "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/entries/{entryId}/decline": {
      "post": {
        "operationId": "declineEntry",
        "summary": "Declines a submitted journal entry and returns it to its author with a reason.",
        "description": "Declines a submitted journal entry and returns it to its author with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "entryId",
            "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
                  },
                  "fault": {
                    "type": "string",
                    "enum": [
                      "WRONG_ACCOUNT",
                      "WRONG_TAX",
                      "WRONG_DIMENSIONS",
                      "DUPLICATE",
                      "NOT_OURS",
                      "OTHER"
                    ]
                  },
                  "correctAccountCode": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  },
                  "memoContains": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 120
                  },
                  "proposeRule": {
                    "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/GetEntryResponse"
                }
              }
            }
          },
          "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/entries/{entryId}/post": {
      "post": {
        "operationId": "postEntry",
        "summary": "Posts an approved journal entry to the general ledger.",
        "description": "Posts an approved journal entry to the general ledger. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "entryId",
            "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/GetEntryResponse"
                }
              }
            }
          },
          "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/entries/{entryId}/reopen": {
      "post": {
        "operationId": "reopenEntry",
        "summary": "Reopens a posted journal entry for correction, returning it to draft.",
        "description": "Reopens a posted journal entry for correction, returning it to draft. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "entryId",
            "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/GetEntryResponse"
                }
              }
            }
          },
          "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/entries/{entryId}/reverse": {
      "post": {
        "operationId": "reverseEntry",
        "summary": "Reverses a posted journal entry with an offsetting entry.",
        "description": "Reverses a posted journal entry with an offsetting entry. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "entryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "memo": {
                    "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/GetEntryResponse"
                }
              }
            }
          },
          "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/entries/{entryId}/submit": {
      "post": {
        "operationId": "submitEntry",
        "summary": "Submits a draft journal entry for approval.",
        "description": "Submits a draft journal entry for approval. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "entryId",
            "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/GetEntryResponse"
                }
              }
            }
          },
          "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/events": {
      "get": {
        "operationId": "listEvents",
        "summary": "Lists the events of one set of books by position, oldest first, optionally of one type.",
        "description": "Lists the events of one set of books by position, oldest first, optionally of one type. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "stable",
        "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
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Type"
            }
          },
          {
            "name": "startPosition",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(0|[1-9]\\d{0,18})$"
            }
          }
        ],
        "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/ListEventsResponseItem"
                      }
                    },
                    "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/events/projections/{projection}/backlog": {
      "get": {
        "operationId": "listProjectionBacklog",
        "summary": "Lists the changes on one set of books that the prepared figures have not taken in yet, oldest first.",
        "description": "Lists the changes on one set of books that the prepared figures have not taken in yet, oldest first. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "projection",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "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": {
                          "position": {
                            "type": "string",
                            "pattern": "^(0|[1-9]\\d{0,18})$"
                          },
                          "label": {
                            "type": "string"
                          },
                          "targetType": {
                            "type": "string"
                          },
                          "targetId": {
                            "type": "string"
                          },
                          "occurredAt": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "position",
                          "label",
                          "targetType",
                          "targetId",
                          "occurredAt"
                        ],
                        "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/events/projections/{projection}/replay": {
      "post": {
        "operationId": "replayProjection",
        "summary": "Starts clearing a hold on the prepared figures and applying the changes waiting for them, as a job you follow.",
        "description": "Starts clearing a hold on the prepared figures and applying the changes waiting for them, as a job you follow. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "projection",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "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"
          },
          "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/events/status": {
      "get": {
        "operationId": "getEventStreamStatus",
        "summary": "Returns how current the prepared customer, supplier and account figures of one set of books are.",
        "description": "Returns how current the prepared customer, supplier and account figures of one set of books are. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "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": {
                    "ledgerPosition": {
                      "type": "string",
                      "pattern": "^(0|[1-9]\\d{0,18})$"
                    },
                    "publishedThrough": {
                      "type": "string",
                      "pattern": "^(0|[1-9]\\d{0,18})$"
                    },
                    "unpublishedCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "oldestUnpublishedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "projections": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ProjectionsItem"
                      }
                    }
                  },
                  "required": [
                    "ledgerPosition",
                    "publishedThrough",
                    "unpublishedCount",
                    "oldestUnpublishedAt",
                    "projections"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/events/{eventId}": {
      "get": {
        "operationId": "getEvent",
        "summary": "Returns one event of the books by its id, with the address of the record it is about.",
        "description": "Returns one event of the books by its id, with the address of the record it is about. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "eventId",
            "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/ListEventsResponseItem"
                }
              }
            }
          },
          "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/evidence/links/{linkId}/detach": {
      "post": {
        "operationId": "detachEvidence",
        "summary": "Detaches an evidence file from a record.",
        "description": "Detaches an evidence file from a record. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "linkId",
            "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/ListEvidenceResponseItem"
                }
              }
            }
          },
          "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/evidence/{subject}/{recordId}": {
      "get": {
        "operationId": "listEvidence",
        "summary": "Lists the evidence files attached to a record.",
        "description": "Lists the evidence files attached to a record. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "subject",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "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
            }
          },
          {
            "name": "detached",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "no",
                "all",
                "only"
              ]
            }
          }
        ],
        "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/ListEvidenceResponseItem"
                      }
                    },
                    "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": "attachEvidence",
        "summary": "Attaches an evidence file to a record.",
        "description": "Attaches an evidence file to a record. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "subject",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "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
                  },
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "documentId"
                ],
                "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/ListEvidenceResponseItem"
                }
              }
            }
          },
          "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/exemption-certificates/documents": {
      "get": {
        "operationId": "listExemptionDocuments",
        "summary": "Lists the documents behind the exemption certificates.",
        "description": "Lists the documents behind the exemption certificates. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "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": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "fileName": {
                            "type": "string"
                          },
                          "mimeType": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "id",
                          "fileName",
                          "mimeType",
                          "createdAt"
                        ],
                        "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/expected-bills": {
      "get": {
        "operationId": "listExpectedBills",
        "summary": "Lists the bills the ledger expects to receive.",
        "description": "Lists the bills the ledger expects to receive. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "month",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "One or more of WAITING, ARRIVED, ACCRUED, ACCRUAL_DECLINED, DISMISSED, separated by commas.",
            "schema": {
              "type": "string",
              "description": "One or more of WAITING, ARRIVED, ACCRUED, ACCRUAL_DECLINED, DISMISSED, separated by commas."
            }
          },
          {
            "name": "vendorId",
            "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": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "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": {
                          "signalId": {
                            "type": "string"
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "month": {
                            "type": "string",
                            "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "WAITING",
                              "ARRIVED",
                              "ACCRUED",
                              "ACCRUAL_DECLINED",
                              "DISMISSED"
                            ]
                          },
                          "severity": {
                            "type": "string"
                          },
                          "observedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "usualDay": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 31
                          },
                          "intervalMonths": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "medianSubtotalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "lastBillDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "accrual": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "amountMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "functionalAmountMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  },
                                  "entryId": {
                                    "type": "string"
                                  },
                                  "entryStatus": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "amountMinor",
                                  "functionalAmountMinor",
                                  "currency",
                                  "entryId",
                                  "entryStatus"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "proposed": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "amountMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "functionalAmountMinor": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^-?\\d+$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "amountMinor",
                                  "functionalAmountMinor"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "whyNot": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "ARRIVED",
                                  "ALREADY_ACCRUED",
                                  "ACCRUAL_DECLINED",
                                  "DISMISSED",
                                  "RATE_MISSING",
                                  "NOT_OPEN"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "whyNotWords": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "selectable": {
                            "type": "boolean"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "signalId",
                          "vendor",
                          "month",
                          "state",
                          "severity",
                          "observedAt",
                          "usualDay",
                          "intervalMonths",
                          "currency",
                          "medianSubtotalMinor",
                          "lastBillDate",
                          "accrual",
                          "proposed",
                          "whyNot",
                          "whyNotWords",
                          "selectable",
                          "entityTimeZone"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "entity": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "functionalCurrency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "timeZone": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "functionalCurrency",
                        "timeZone"
                      ],
                      "additionalProperties": false
                    },
                    "month": {
                      "type": "string",
                      "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                    },
                    "monthLabel": {
                      "type": "string"
                    },
                    "lastCheckedOn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "accruedAccount": {
                      "$ref": "#/components/schemas/Account"
                    },
                    "refusal": {
                      "$ref": "#/components/schemas/Refusal"
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "waiting": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "arrived": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "accrued": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "declined": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "dismissed": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "waiting",
                        "arrived",
                        "accrued",
                        "declined",
                        "dismissed"
                      ],
                      "additionalProperties": false
                    },
                    "waitingTotals": {
                      "$ref": "#/components/schemas/WaitingTotals"
                    },
                    "patterns": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "data",
                    "total",
                    "nextCursor",
                    "entity",
                    "month",
                    "monthLabel",
                    "lastCheckedOn",
                    "accruedAccount",
                    "refusal",
                    "counts",
                    "waitingTotals",
                    "patterns"
                  ],
                  "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/expected-bills/accruals": {
      "post": {
        "operationId": "proposeExpectedBillAccrual",
        "summary": "Proposes an accrual for an expected bill, for a person to decide.",
        "description": "Proposes an accrual for an expected bill, for a person to decide. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
                  },
                  "periodYear": {
                    "type": "integer",
                    "minimum": 2000,
                    "maximum": 2100
                  },
                  "periodMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "signalIds": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": [
                  "entityId",
                  "periodYear",
                  "periodMonth",
                  "signalIds"
                ],
                "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": {
                  "type": "object",
                  "properties": {
                    "entryId": {
                      "type": "string"
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "totalFunctionalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "suppliers": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "entryDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "reversalDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "vendorId": {
                            "type": "string"
                          },
                          "signalId": {
                            "type": "string"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          }
                        },
                        "required": [
                          "vendorId",
                          "signalId",
                          "amountMinor",
                          "currency"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "entryId",
                    "created",
                    "status",
                    "currency",
                    "totalFunctionalMinor",
                    "suppliers",
                    "entryDate",
                    "reversalDate",
                    "rows"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/expected-clearings": {
      "get": {
        "operationId": "listExpectedClearings",
        "summary": "Lists the expected clearings the ledger is waiting on.",
        "description": "Lists the expected clearings the ledger is waiting on. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "EXPECTED",
                "LATE",
                "CLEARED",
                "WITHDRAWN"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "financialAccountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "paymentRunId",
            "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": {
                          "id": {
                            "type": "string"
                          },
                          "sourceKind": {
                            "type": "string",
                            "enum": [
                              "PAYMENT_RUN",
                              "RUN_PAYMENT"
                            ]
                          },
                          "paymentRunId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paymentId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "runLabel": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "financialAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              },
                              "hasFeed": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "displayName",
                              "hasFeed"
                            ],
                            "additionalProperties": false
                          },
                          "expectedOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "windowFrom": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "windowTo": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "reference": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "lineCount": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "OPEN",
                              "MATCHED",
                              "WITHDRAWN"
                            ]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "EXPECTED",
                              "LATE",
                              "CLEARED",
                              "WITHDRAWN"
                            ]
                          },
                          "statementThrough": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "matchedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "matchedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "matchedBankLine": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "postedOn": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "description": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "postedOn",
                                  "description"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "withdrawnAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "withdrawnBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "withdrawnCause": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "RUN_REVERSED",
                                  "BANK_REJECTED",
                                  "PAYMENT_REVERSED"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "backfilled": {
                            "type": "boolean"
                          },
                          "createdAt": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "id",
                          "sourceKind",
                          "paymentRunId",
                          "paymentId",
                          "runLabel",
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "financialAccount",
                          "expectedOn",
                          "windowFrom",
                          "windowTo",
                          "amountMinor",
                          "currency",
                          "reference",
                          "lineCount",
                          "status",
                          "state",
                          "statementThrough",
                          "matchedAt",
                          "matchedBy",
                          "matchedBankLine",
                          "withdrawnAt",
                          "withdrawnBy",
                          "withdrawnCause",
                          "backfilled",
                          "createdAt"
                        ],
                        "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/export/requests": {
      "post": {
        "operationId": "requestFullExport",
        "summary": "Asks for a full export of the ledger, which a second person must approve.",
        "description": "Asks for a full export of the ledger, which a second person must approve. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "path": {
                        "type": "string",
                        "const": "TWO_PERSON"
                      },
                      "reason": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      "includeBankFiles": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "path",
                      "reason",
                      "includeBankFiles"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "path": {
                        "type": "string",
                        "const": "SOLE_ADMIN_OWNER_OVERRIDE"
                      },
                      "reason": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      "includeBankFiles": {
                        "type": "boolean"
                      },
                      "overrideReason": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      "overrideCapacity": {
                        "type": "string",
                        "enum": [
                          "OWN_ORGANIZATION",
                          "MANAGING_FIRM"
                        ]
                      }
                    },
                    "required": [
                      "path",
                      "reason",
                      "includeBankFiles",
                      "overrideReason",
                      "overrideCapacity"
                    ],
                    "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/RequestFullExportResponse"
                }
              }
            }
          },
          "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": "listFullExportRequests",
        "summary": "Lists the full export requests and where each one stands.",
        "description": "Lists the full export requests and where each one stands. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "WAITING",
                "APPROVED",
                "DOWNLOADED",
                "DECLINED",
                "WITHDRAWN",
                "EXPIRED",
                "CANCELLED"
              ]
            }
          },
          {
            "name": "mine",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          },
          {
            "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/RequestFullExportResponseOption1"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "context": {
                      "type": "object",
                      "properties": {
                        "adminSeats": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "people": {
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "count",
                            "people"
                          ],
                          "additionalProperties": false
                        },
                        "override": {
                          "type": "object",
                          "properties": {
                            "available": {
                              "type": "boolean"
                            },
                            "capacity": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "OWN_ORGANIZATION",
                                    "MANAGING_FIRM"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "available",
                            "capacity"
                          ],
                          "additionalProperties": false
                        },
                        "carries": {
                          "type": "object",
                          "properties": {
                            "tables": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "vendorsWithVerifiedBanking": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "bankFiles": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "tables",
                            "vendorsWithVerifiedBanking",
                            "bankFiles"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "adminSeats",
                        "override",
                        "carries"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "context"
                  ],
                  "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/export/requests/{requestId}/approve": {
      "post": {
        "operationId": "approveFullExport",
        "summary": "Approves a full export request so that its archive can be produced.",
        "description": "Approves a full export request so that its archive can be produced. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "includeBankFiles": {
                    "type": "boolean"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "brief": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "promptVersion": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          },
                          "purpose": {
                            "type": "string",
                            "enum": [
                              "AUDIT_OR_REVIEW",
                              "ACCOUNTANT_HANDOVER",
                              "MOVING_TO_ANOTHER_SYSTEM",
                              "LEGAL_OR_REGULATORY",
                              "BACKUP",
                              "OFF_BOARDING",
                              "OTHER",
                              "UNCLEAR"
                            ]
                          },
                          "bankFiles": {
                            "type": "string",
                            "enum": [
                              "EXPLAINED",
                              "NOT_EXPLAINED",
                              "NOT_ASKED"
                            ]
                          },
                          "addressedToApprover": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "promptVersion",
                          "purpose",
                          "bankFiles",
                          "addressedToApprover"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "includeBankFiles"
                ],
                "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/RequestFullExportResponse"
                }
              }
            }
          },
          "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/export/requests/{requestId}/brief": {
      "post": {
        "operationId": "draftFullExportBrief",
        "summary": "Drafts the brief a person reads before approving a full export.",
        "description": "Drafts the brief a person reads before approving a full export. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "requestId",
            "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": {
                    "brief": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "purpose": {
                              "type": "string",
                              "enum": [
                                "AUDIT_OR_REVIEW",
                                "ACCOUNTANT_HANDOVER",
                                "MOVING_TO_ANOTHER_SYSTEM",
                                "LEGAL_OR_REGULATORY",
                                "BACKUP",
                                "OFF_BOARDING",
                                "OTHER",
                                "UNCLEAR"
                              ]
                            },
                            "bankFiles": {
                              "type": "string",
                              "enum": [
                                "EXPLAINED",
                                "NOT_EXPLAINED",
                                "NOT_ASKED"
                              ]
                            },
                            "addressedToApprover": {
                              "type": "boolean"
                            },
                            "summary": {
                              "type": "string"
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "purpose",
                            "bankFiles",
                            "addressedToApprover",
                            "summary",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "type": "string",
                      "enum": [
                        "DISCLOSURE",
                        "BUDGET",
                        "PROVIDER",
                        "UNPARSABLE",
                        "REFUSED",
                        "FIGURE_INVENTED",
                        "NOT_WAITING",
                        "OWN_REQUEST"
                      ]
                    }
                  },
                  "required": [
                    "brief"
                  ],
                  "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/export/requests/{requestId}/decline": {
      "post": {
        "operationId": "declineFullExport",
        "summary": "Declines a full export request with a reason.",
        "description": "Declines a full export request with a reason. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "requestId",
            "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/RequestFullExportResponseOption1"
                }
              }
            }
          },
          "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/export/requests/{requestId}/withdraw": {
      "post": {
        "operationId": "withdrawFullExport",
        "summary": "Withdraws a full export request its requester no longer wants.",
        "description": "Withdraws a full export request its requester no longer wants. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "requestId",
            "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/RequestFullExportResponseOption1"
                }
              }
            }
          },
          "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/feed-account-suggestions/{suggestionId}/decline": {
      "post": {
        "operationId": "declineFeedAccountSuggestion",
        "summary": "Declines a suggested account for a connection's feed.",
        "description": "Declines a suggested account for a connection's feed. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "suggestionId",
            "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/SuggestFeedAccountResponse"
                }
              }
            }
          },
          "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/financial-accounts/registrable": {
      "get": {
        "operationId": "listRegistrableConnections",
        "summary": "Lists the bank connections that can be registered as financial accounts.",
        "description": "Lists the bank connections that can be registered as financial accounts. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "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": {
                    "connections": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "connectionId": {
                            "type": "string"
                          },
                          "connectionName": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "string"
                          },
                          "stagedLineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "statementCurrencies": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "currency": {
                                  "type": "string"
                                },
                                "lineCount": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "currency",
                                "lineCount"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "registeredCurrencies": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "stagedKinds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "connectionId",
                          "connectionName",
                          "provider",
                          "stagedLineCount",
                          "statementCurrencies",
                          "registeredCurrencies",
                          "stagedKinds"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "truncated": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "connections",
                    "total",
                    "truncated"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/first-week": {
      "get": {
        "operationId": "getFirstWeek",
        "summary": "Returns the first-week checklist for a new ledger.",
        "description": "Returns the first-week checklist for a new ledger. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "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": {
                    "entity": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "readAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "today": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "suppliers": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "READ"
                            },
                            "active": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "state",
                            "active"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "UNREAD"
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "banking": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "READ"
                            },
                            "verified": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "owedWithoutVerified": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "waitingForSecondPerson": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "state",
                            "verified",
                            "owedWithoutVerified",
                            "waitingForSecondPerson"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "UNREAD"
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "conversion": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "READ"
                            },
                            "cutover": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "state": {
                                      "type": "string",
                                      "enum": [
                                        "OPEN",
                                        "SETTLED"
                                      ]
                                    },
                                    "conversionDate": {
                                      "type": "string",
                                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "state",
                                    "conversionDate"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "liveBills": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "state",
                            "cutover",
                            "liveBills"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "UNREAD"
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "tieOut": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "READ"
                            },
                            "postedBills": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "tie": {
                              "type": "string",
                              "enum": [
                                "TIED",
                                "NOT_TIED",
                                "NOT_READ"
                              ]
                            }
                          },
                          "required": [
                            "state",
                            "postedBills",
                            "tie"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "UNREAD"
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "inbox": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "READ"
                            },
                            "addresses": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "handedOut": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "state",
                            "addresses",
                            "handedOut"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "UNREAD"
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "approvalPolicy": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "READ"
                            },
                            "setByPerson": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "state",
                            "setByPerson"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "UNREAD"
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "parallelRun": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "READ"
                            },
                            "months": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "signedOff": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "state",
                            "months",
                            "signedOff"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "UNREAD"
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "entity",
                    "entityTimeZone",
                    "readAt",
                    "today",
                    "suppliers",
                    "banking",
                    "conversion",
                    "tieOut",
                    "inbox",
                    "approvalPolicy",
                    "parallelRun"
                  ],
                  "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/fx": {
      "get": {
        "operationId": "listFxRates",
        "summary": "Lists the foreign exchange rates the ledger uses.",
        "description": "Lists the foreign exchange rates the ledger uses. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BOC",
                "MANUAL",
                "PROVIDER",
                "IMPORTED"
              ]
            }
          },
          {
            "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}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListFxRatesResponseItem"
                      }
                    },
                    "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
                }
              }
            }
          },
          "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/fx/override": {
      "post": {
        "operationId": "overrideFx",
        "summary": "Overrides the exchange rate for one currency and day.",
        "description": "Overrides the exchange rate for one currency and day. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rateDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "base": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "quote": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "rate": {
                    "type": "string",
                    "pattern": "^\\d+(\\.\\d{1,6})?$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "fromImportedHistoryId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "rateDate",
                  "base",
                  "quote",
                  "rate",
                  "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/ListFxRatesResponseItem"
                }
              }
            }
          },
          "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/fx/override/remove": {
      "post": {
        "operationId": "removeFxOverride",
        "summary": "Takes back this ledger's own exchange rate for one currency and day, so the observed rate converts again.",
        "description": "Takes back this ledger's own exchange rate for one currency and day, so the observed rate converts again. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rateDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "base": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "quote": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "setRate": {
                    "type": "string",
                    "pattern": "^\\d+(\\.\\d{1,6})?$"
                  },
                  "restore": {
                    "type": "object",
                    "properties": {
                      "rate": {
                        "type": "string",
                        "pattern": "^\\d+(\\.\\d{1,6})?$"
                      },
                      "reason": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 300
                      },
                      "wasEnteredById": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "rate",
                      "reason"
                    ],
                    "additionalProperties": false
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  }
                },
                "required": [
                  "rateDate",
                  "base",
                  "quote",
                  "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/ListFxRatesResponseItem"
                }
              }
            }
          },
          "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/goods-receipts": {
      "get": {
        "operationId": "listGoodsReceipts",
        "summary": "Lists the goods receipts, with the server's total.",
        "description": "Lists the goods receipts, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "purchaseOrderId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PROPOSED",
                "CONFIRMED",
                "VOID",
                "DISCARDED"
              ]
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "MANUAL",
                "SLIP_READ",
                "SLIP_MAILED"
              ]
            }
          },
          {
            "name": "receivedById",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "awaiting",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "const": "confirm"
            }
          },
          {
            "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"
                          },
                          "purchaseOrderId": {
                            "type": "string"
                          },
                          "orderNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sequence": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "PROPOSED",
                              "CONFIRMED",
                              "VOID",
                              "DISCARDED"
                            ]
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "MANUAL",
                              "SLIP_READ",
                              "SLIP_MAILED"
                            ]
                          },
                          "entity": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "receivedOn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "receivedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "onBehalfOf": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "attachmentCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "proposedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "voided": {
                            "$ref": "#/components/schemas/Retired"
                          },
                          "discarded": {
                            "$ref": "#/components/schemas/Retired"
                          }
                        },
                        "required": [
                          "id",
                          "purchaseOrderId",
                          "orderNumber",
                          "sequence",
                          "status",
                          "source",
                          "entity",
                          "entityTimeZone",
                          "receivedOn",
                          "receivedBy",
                          "onBehalfOf",
                          "lineCount",
                          "attachmentCount",
                          "proposedAt",
                          "voided",
                          "discarded"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "total",
                    "nextCursor"
                  ],
                  "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": "recordGoodsReceipt",
        "summary": "Records the goods received against a purchase order.",
        "description": "Records the goods received against a purchase order. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "purchaseOrderId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "receivedOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "signedForBy": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "note": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines7"
                  },
                  "onBehalfOfId": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "evidenceDocumentIds": {
                    "default": [],
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "seenSequence": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "slip": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "promptVersion": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          },
                          "linesRead": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 200
                          },
                          "linesKept": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 200
                          }
                        },
                        "required": [
                          "promptVersion",
                          "linesRead",
                          "linesKept"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "purchaseOrderId",
                  "receivedOn",
                  "lines",
                  "seenSequence"
                ],
                "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/RecordGoodsReceiptResponse"
                }
              }
            }
          },
          "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/goods-receipts/slip-read": {
      "post": {
        "operationId": "readGoodsReceiptSlip",
        "summary": "Reads the packing slip a goods receipt was taken from.",
        "description": "Reads the packing slip a goods receipt was taken from. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "purchaseOrderId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "documentId",
                  "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"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "read": {
                          "type": "object",
                          "properties": {
                            "supplier": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "orderReference": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "slipNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "shipDate": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "matchedBy": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "REFERENCE",
                                    "SUPPLIER_ONLY"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "purchaseOrderLineId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "slipDescription": {
                                    "type": "string"
                                  },
                                  "shippedQuantity": {
                                    "type": "string",
                                    "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                                  },
                                  "orderedQuantity": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "backorderedQuantity": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "evidence": {
                                    "type": "string"
                                  },
                                  "unread": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "required": [
                                  "purchaseOrderLineId",
                                  "slipDescription",
                                  "shippedQuantity",
                                  "orderedQuantity",
                                  "backorderedQuantity",
                                  "evidence",
                                  "unread"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "unmatchedSlipLines": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "warnings": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "pagesRead": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "charsRead": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "charsThere": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "supplier",
                            "orderReference",
                            "slipNumber",
                            "shipDate",
                            "matchedBy",
                            "lines",
                            "unmatchedSlipLines",
                            "warnings",
                            "pagesRead",
                            "charsRead",
                            "charsThere",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        "why": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "read",
                        "why"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "read": {
                          "type": "null"
                        },
                        "why": {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNPARSABLE",
                            "REFUSED",
                            "UNREADABLE",
                            "NOT_A_SLIP",
                            "PAUSED"
                          ]
                        },
                        "resumesOn": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        }
                      },
                      "required": [
                        "read",
                        "why"
                      ],
                      "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/goods-receipts/{goodsReceiptId}": {
      "get": {
        "operationId": "getGoodsReceipt",
        "summary": "Returns one goods receipt with its lines.",
        "description": "Returns one goods receipt with its lines. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "goodsReceiptId",
            "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/Receipt"
                }
              }
            }
          },
          "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/goods-receipts/{goodsReceiptId}/confirm": {
      "post": {
        "operationId": "confirmGoodsReceipt",
        "summary": "Confirms a goods receipt so it counts against the purchase order.",
        "description": "Confirms a goods receipt so it counts against the purchase order. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "goodsReceiptId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "receivedOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "signedForBy": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "note": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines7"
                  },
                  "onBehalfOfId": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "evidenceDocumentIds": {
                    "default": [],
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "seenSequence": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "receivedOn",
                  "lines",
                  "seenSequence"
                ],
                "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/RecordGoodsReceiptResponse"
                }
              }
            }
          },
          "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/goods-receipts/{goodsReceiptId}/discard": {
      "post": {
        "operationId": "discardGoodsReceipt",
        "summary": "Discards a goods receipt that has not been confirmed.",
        "description": "Discards a goods receipt that has not been confirmed. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "goodsReceiptId",
            "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/RecordGoodsReceiptResponse"
                }
              }
            }
          },
          "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/goods-receipts/{goodsReceiptId}/evidence": {
      "post": {
        "operationId": "attachGoodsReceiptEvidence",
        "summary": "Attaches evidence to a goods receipt.",
        "description": "Attaches evidence to a goods receipt. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "goodsReceiptId",
            "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
                  },
                  "caption": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 200
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "documentId"
                ],
                "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/Receipt"
                }
              }
            }
          },
          "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/goods-receipts/{goodsReceiptId}/evidence/{evidenceId}/withdraw": {
      "post": {
        "operationId": "withdrawGoodsReceiptEvidence",
        "summary": "Withdraws evidence attached to a goods receipt.",
        "description": "Withdraws evidence attached to a goods receipt. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "goodsReceiptId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "evidenceId",
            "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/Receipt"
                }
              }
            }
          },
          "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/goods-receipts/{goodsReceiptId}/void": {
      "post": {
        "operationId": "voidGoodsReceipt",
        "summary": "Voids a confirmed goods receipt.",
        "description": "Voids a confirmed goods receipt. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "goodsReceiptId",
            "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/RecordGoodsReceiptResponse"
                }
              }
            }
          },
          "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/held-outbound": {
      "get": {
        "operationId": "listHeldOutbound",
        "summary": "Lists the messages a test copy held instead of sending, newest first.",
        "description": "Lists the messages a test copy held instead of sending, newest first. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "mail",
                "payment-rail",
                "payment-collect",
                "bank-file",
                "cra-filing",
                "provider-config",
                "books-export",
                "webhook",
                "warehouse"
              ]
            }
          },
          {
            "name": "sender",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "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/ListHeldOutboundResponseItem"
                      }
                    },
                    "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/held-outbound/{heldId}": {
      "get": {
        "operationId": "getHeldOutbound",
        "summary": "Reads one message a test copy held instead of sending, with its recipients, attachments and text.",
        "description": "Reads one message a test copy held instead of sending, with its recipients, attachments and text. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "heldId",
            "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/ListHeldOutboundResponseItem"
                }
              }
            }
          },
          "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/imported-history": {
      "get": {
        "operationId": "listImportedHistory",
        "summary": "Lists the history imported from an earlier system, with the server's total.",
        "description": "Lists the history imported from an earlier system, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "AUDIT_LINE",
                "CONTROL_FIRING",
                "PERIOD_LOCK",
                "REPORT_PACK",
                "SLIP_FILE",
                "FX_RATE",
                "SCHEDULE",
                "QUEUE_DECISION",
                "TAX_OVERRIDE",
                "PAID_BILL",
                "VENDOR_PAYMENT"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "importId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "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}$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "placement",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PLACED",
                "UNPLACED"
              ]
            }
          },
          {
            "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/ListImportedHistoryResponse"
                    },
                    "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/imported-history/{recordId}": {
      "get": {
        "operationId": "getImportedHistoryRecord",
        "summary": "Returns one record of imported history.",
        "description": "Returns one record of imported history. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "recordId",
            "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/Record"
                }
              }
            }
          },
          "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/imports/csv/requests": {
      "post": {
        "operationId": "requestCsvImport",
        "summary": "Asks for an uploaded CSV statement to be imported into the bank feed now, and answers the connection whose run history shows it.",
        "description": "Asks for an uploaded CSV statement to be imported into the bank feed now, and answers the connection whose run history shows it. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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": 80
                  },
                  "mapping": {
                    "type": "object",
                    "properties": {
                      "date": {
                        "type": "string",
                        "minLength": 1
                      },
                      "description": {
                        "type": "string",
                        "minLength": 1
                      },
                      "amount": {
                        "type": "string"
                      },
                      "debit": {
                        "type": "string"
                      },
                      "credit": {
                        "type": "string"
                      },
                      "counterparty": {
                        "type": "string"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "externalId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "date",
                      "description"
                    ],
                    "additionalProperties": false
                  },
                  "currency": {
                    "default": "CAD",
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "dateFormat": {
                    "default": "iso",
                    "type": "string",
                    "enum": [
                      "iso",
                      "us",
                      "eu"
                    ]
                  },
                  "objectKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                  },
                  "fileName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "financialAccountId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "displayName",
                  "mapping",
                  "objectKey",
                  "fileName"
                ],
                "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": {
                    "connectionId": {
                      "type": "string"
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "evidenceKey": {
                      "type": "string"
                    },
                    "requestedAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "connectionId",
                    "requestId",
                    "evidenceKey",
                    "requestedAt"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/imports/{syncRunId}/propose": {
      "post": {
        "operationId": "proposeFromImport",
        "summary": "Proposes journal entries from the rows of one import run for a person to decide.",
        "description": "Proposes journal entries from the rows of one import run for a person to decide. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "syncRunId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contraAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 500
                  }
                },
                "required": [
                  "contraAccountId"
                ],
                "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": {
                  "type": "object",
                  "properties": {
                    "proposed": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "alreadyProposed": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "remaining": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "returnedWithEntry": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "settledByPayout": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "bankAccountCode": {
                      "type": "string"
                    },
                    "contraAccountCode": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "proposed",
                    "alreadyProposed",
                    "remaining",
                    "returnedWithEntry",
                    "settledByPayout",
                    "entityId",
                    "entityName",
                    "bankAccountCode",
                    "contraAccountCode"
                  ],
                  "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/inbound-addresses": {
      "get": {
        "operationId": "listInboundAddresses",
        "summary": "Lists the inbound email addresses the ledger receives documents at.",
        "description": "Lists the inbound email addresses the ledger receives documents at. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "inboundDomainId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "onDomain",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "const": "true"
            }
          },
          {
            "name": "mailbox",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BILLS",
                "INVOICES"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "REVOKED"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "watcherUserId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "watcherAccess",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "LOST"
              ]
            }
          },
          {
            "name": "hasHeld",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            }
          }
        ],
        "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/ListInboundAddressesResponseItem"
                      }
                    },
                    "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": "createInboundAddress",
        "summary": "Creates an inbound email address for the ledger.",
        "description": "Creates an inbound email address for the ledger. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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
                  },
                  "label": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 24,
                    "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                  },
                  "mailbox": {
                    "default": "BILLS",
                    "type": "string",
                    "enum": [
                      "BILLS",
                      "INVOICES"
                    ]
                  },
                  "inboundDomainId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "vendorId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "purpose": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "watcherUserId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "watcherTelephone": {
                    "type": "string",
                    "maxLength": 40
                  }
                },
                "required": [
                  "entityId",
                  "label"
                ],
                "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/ListInboundAddressesResponseItem"
                }
              }
            }
          },
          "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/inbound-addresses/{addressId}": {
      "get": {
        "operationId": "getInboundAddress",
        "summary": "Returns one inbound email address with its binding and watcher.",
        "description": "Returns one inbound email address with its binding and watcher. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "addressId",
            "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/GetInboundAddressResponse"
                }
              }
            }
          },
          "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/inbound-addresses/{addressId}/binding": {
      "post": {
        "operationId": "setInboundAddressBinding",
        "summary": "Binds an inbound email address to a vendor or customer.",
        "description": "Binds an inbound email address to a vendor or customer. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "addressId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "vendorId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "purpose": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "fromSuggestion": {
                    "default": false,
                    "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": {
                  "$ref": "#/components/schemas/GetInboundAddressResponse"
                }
              }
            }
          },
          "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/inbound-addresses/{addressId}/binding-suggestion/decline": {
      "post": {
        "operationId": "declineInboundAddressSuggestion",
        "summary": "Declines the suggested binding of an inbound email address.",
        "description": "Declines the suggested binding of an inbound email address. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "addressId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "vendorId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "vendorId"
                ],
                "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/GetInboundAddressResponse"
                }
              }
            }
          },
          "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/inbound-addresses/{addressId}/closing": {
      "post": {
        "operationId": "scheduleAddressClosing",
        "summary": "Schedules the closing of an inbound email address.",
        "description": "Schedules the closing of an inbound email address. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "addressId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "closesOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "successorAddressId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 280
                  }
                },
                "required": [
                  "closesOn",
                  "successorAddressId",
                  "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/ListInboundAddressesResponseItem"
                }
              }
            }
          },
          "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/inbound-addresses/{addressId}/closing/withdraw": {
      "post": {
        "operationId": "withdrawAddressClosing",
        "summary": "Withdraws a scheduled closing of an inbound email address.",
        "description": "Withdraws a scheduled closing of an inbound email address. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "addressId",
            "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": 4,
                    "maxLength": 280
                  },
                  "expectedClosesOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "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/ListInboundAddressesResponseItem"
                }
              }
            }
          },
          "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/inbound-addresses/{addressId}/replies": {
      "post": {
        "operationId": "enableInboxReplies",
        "summary": "Turns on replies from an inbound email address.",
        "description": "Turns on replies from an inbound email address. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "addressId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "until": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "until"
                ],
                "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/ListInboundAddressesResponseItem"
                }
              }
            }
          },
          "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/inbound-addresses/{addressId}/replies/off": {
      "post": {
        "operationId": "disableInboxReplies",
        "summary": "Turns off replies from an inbound email address.",
        "description": "Turns off replies from an inbound email address. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "addressId",
            "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": 4,
                    "maxLength": 280
                  }
                },
                "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/ListInboundAddressesResponseItem"
                }
              }
            }
          },
          "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/inbound-addresses/{addressId}/revoke": {
      "post": {
        "operationId": "revokeInboundAddress",
        "summary": "Revokes an inbound email address.",
        "description": "Revokes an inbound email address. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "addressId",
            "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": 4,
                    "maxLength": 280
                  }
                },
                "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/ListInboundAddressesResponseItem"
                }
              }
            }
          },
          "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/inbound-addresses/{addressId}/watcher": {
      "post": {
        "operationId": "changeInboundAddressWatcher",
        "summary": "Changes the person who watches an inbound email address.",
        "description": "Changes the person who watches an inbound email address. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "addressId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "watcherUserId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "watcherTelephone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 40
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "expectedWatcherUserId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "watcherUserId",
                  "watcherTelephone",
                  "expectedWatcherUserId"
                ],
                "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/GetInboundAddressResponse"
                }
              }
            }
          },
          "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/inbound-domains": {
      "get": {
        "operationId": "listInboundDomains",
        "summary": "Lists the email domains the ledger receives documents from.",
        "description": "Lists the email domains the ledger receives documents from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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": [
                "PENDING",
                "VERIFIED",
                "DEGRADED",
                "REMOVED"
              ]
            }
          },
          {
            "name": "includeRemoved",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "const": "true"
            }
          },
          {
            "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/ListInboundDomainsResponseItem"
                      }
                    },
                    "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/inbound-domains/requests": {
      "post": {
        "operationId": "requestInboundDomain",
        "summary": "Asks to add an email domain for a company and answers the pending domain; read getInboundDomain to see whether the name was claimed.",
        "description": "Asks to add an email domain for a company and answers the pending domain; read getInboundDomain to see whether the name was claimed. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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
                  },
                  "domain": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "entityId",
                  "domain"
                ],
                "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/ListInboundDomainsResponseItem"
                }
              }
            }
          },
          "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/inbound-domains/{domainId}": {
      "get": {
        "operationId": "getInboundDomain",
        "summary": "Returns one inbound email domain with its verification status.",
        "description": "Returns one inbound email domain with its verification status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "domainId",
            "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/ListInboundDomainsResponseItem"
                }
              }
            }
          },
          "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/inbound-domains/{domainId}/audit": {
      "get": {
        "operationId": "listInboundDomainAudit",
        "summary": "Lists the audit trail of one inbound email domain.",
        "description": "Lists the audit trail of one inbound email domain. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "domainId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "action",
            "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/inbound-domains/{domainId}/check": {
      "post": {
        "operationId": "checkInboundDomain",
        "summary": "Checks the DNS records of an inbound email domain.",
        "description": "Checks the DNS records of an inbound email domain. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "domainId",
            "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/ListInboundDomainsResponseItem"
                }
              }
            }
          },
          "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/inbound-domains/{domainId}/explanation": {
      "post": {
        "operationId": "explainInboundDomain",
        "summary": "Explains the state of an inbound email domain in plain words.",
        "description": "Explains the state of an inbound email domain in plain words. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "domainId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "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"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "facts": {
                      "type": "object",
                      "properties": {
                        "findings": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "NO_MX",
                              "MX_ELSEWHERE",
                              "CNAME_AT_NAME",
                              "NO_PROOF",
                              "PROOF_WRONG",
                              "DOUBLED_SUFFIX",
                              "PROVISION_FAILED"
                            ]
                          }
                        },
                        "failedChecks": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "daysWaiting": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "findings",
                        "failedChecks",
                        "daysWaiting"
                      ],
                      "additionalProperties": false
                    },
                    "checklist": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "finding": {
                            "type": "string",
                            "enum": [
                              "NO_MX",
                              "MX_ELSEWHERE",
                              "CNAME_AT_NAME",
                              "NO_PROOF",
                              "PROOF_WRONG",
                              "DOUBLED_SUFFIX",
                              "PROVISION_FAILED"
                            ]
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "finding",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "paragraph": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string"
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "text",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNPARSABLE",
                            "REFUSED",
                            "NOTHING_TO_EXPLAIN"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "facts",
                    "checklist",
                    "paragraph",
                    "why"
                  ],
                  "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/inbound-domains/{domainId}/platform-senders": {
      "get": {
        "operationId": "listPlatformSenders",
        "summary": "Lists the platform senders allowed through an inbound domain.",
        "description": "Lists the platform senders allowed through an inbound domain. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "domainId",
            "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": {
                          "senderDomain": {
                            "type": "string"
                          },
                          "vendorName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "messages": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "lastMessageAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "addressId": {
                            "type": "string"
                          },
                          "addressLabel": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "senderDomain",
                          "vendorName",
                          "messages",
                          "lastMessageAt",
                          "addressId",
                          "addressLabel"
                        ],
                        "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/inbound-domains/{domainId}/remove": {
      "post": {
        "operationId": "removeInboundDomain",
        "summary": "Removes an inbound email domain.",
        "description": "Removes an inbound email domain. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "domainId",
            "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": 4,
                    "maxLength": 280
                  }
                },
                "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/ListInboundDomainsResponseItem"
                }
              }
            }
          },
          "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/inbound-emails": {
      "get": {
        "operationId": "listInboundEmails",
        "summary": "Lists the inbound emails the ledger received, with the server's total.",
        "description": "Lists the inbound emails the ledger received, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "addressId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "mailbox",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BILLS",
                "INVOICES"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "senderDomain",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 253
            }
          },
          {
            "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}$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "waiting",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          },
          {
            "name": "mine",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          },
          {
            "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": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "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"
                          },
                          "receivedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "addressId": {
                            "type": "string"
                          },
                          "address": {
                            "type": "string"
                          },
                          "addressLabel": {
                            "type": "string"
                          },
                          "mailbox": {
                            "type": "string",
                            "enum": [
                              "BILLS",
                              "INVOICES"
                            ]
                          },
                          "sender": {
                            "type": "string"
                          },
                          "senderDomain": {
                            "type": "string"
                          },
                          "subject": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 200
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "partCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reference": {
                            "type": "string"
                          },
                          "partNames": {
                            "maxItems": 60,
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "READ",
                              "IN_REVIEW",
                              "BOOKED",
                              "UNREADABLE",
                              "NOT_A_BILL",
                              "DUPLICATE",
                              "HELD",
                              "SLIP",
                              "STATEMENT"
                            ]
                          },
                          "stateSentence": {
                            "type": "string"
                          },
                          "became": {
                            "$ref": "#/components/schemas/Became2"
                          },
                          "reading": {
                            "$ref": "#/components/schemas/Reading3"
                          },
                          "waiting": {
                            "type": "boolean"
                          },
                          "auth": {
                            "$ref": "#/components/schemas/Auth"
                          },
                          "forward": {
                            "type": "object",
                            "properties": {
                              "state": {
                                "type": "string",
                                "enum": [
                                  "UNRECORDED",
                                  "DIRECT",
                                  "FORWARDED"
                                ]
                              },
                              "forwardedByName": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "state",
                              "forwardedByName"
                            ],
                            "additionalProperties": false
                          },
                          "statement": {
                            "$ref": "#/components/schemas/Statement"
                          },
                          "vendorQuery": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "reference": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "reference"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "receivedAt",
                          "entityTimeZone",
                          "entityId",
                          "entityName",
                          "addressId",
                          "address",
                          "addressLabel",
                          "mailbox",
                          "sender",
                          "senderDomain",
                          "subject",
                          "partCount",
                          "reference",
                          "partNames",
                          "state",
                          "stateSentence",
                          "became",
                          "reading",
                          "waiting",
                          "auth",
                          "forward",
                          "statement",
                          "vendorQuery"
                        ],
                        "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/inbound-emails/bulk/handled": {
      "post": {
        "operationId": "bulkMarkInboundEmailsHandled",
        "summary": "Marks several inbound emails as handled in one request.",
        "description": "Marks several inbound emails as handled in one request. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkHoldVendorPaymentsRequest"
              }
            }
          }
        },
        "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/BulkHoldVendorPaymentsResponse"
                }
              }
            }
          },
          "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/inbound-emails/bulk/not-a-bill": {
      "post": {
        "operationId": "bulkMarkInboundEmailsNotABill",
        "summary": "Marks several inbound emails as not bills in one request.",
        "description": "Marks several inbound emails as not bills in one request. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkHoldVendorPaymentsRequest"
              }
            }
          }
        },
        "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/BulkHoldVendorPaymentsResponse"
                }
              }
            }
          },
          "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/inbound-emails/summary": {
      "get": {
        "operationId": "summarizeInboundEmails",
        "summary": "Returns the counts of inbound emails by what happened to them.",
        "description": "Returns the counts of inbound emails by what happened to them. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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": {
                    "from": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "to": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "timeZone": {
                      "type": "string"
                    },
                    "arrived": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "byState": {
                      "type": "object",
                      "properties": {
                        "READ": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "IN_REVIEW": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "BOOKED": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "UNREADABLE": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "NOT_A_BILL": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "DUPLICATE": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "HELD": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "SLIP": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "STATEMENT": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "READ",
                        "IN_REVIEW",
                        "BOOKED",
                        "UNREADABLE",
                        "NOT_A_BILL",
                        "DUPLICATE",
                        "HELD",
                        "SLIP",
                        "STATEMENT"
                      ],
                      "additionalProperties": false
                    },
                    "refused": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "waiting": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "byAddress": {
                      "maxItems": 6,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "addressId": {
                            "type": "string"
                          },
                          "address": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "mailbox": {
                            "type": "string",
                            "enum": [
                              "BILLS",
                              "INVOICES"
                            ]
                          },
                          "arrived": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "booked": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "bookedOrReview": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "addressId",
                          "address",
                          "label",
                          "mailbox",
                          "arrived",
                          "booked"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "moreAddresses": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "byEntity": {
                      "maxItems": 6,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "arrived": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "booked": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "bookedOrReview": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "entityId",
                          "entityName",
                          "arrived",
                          "booked"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "moreEntities": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "from",
                    "to",
                    "timeZone",
                    "arrived",
                    "byState",
                    "refused",
                    "waiting",
                    "byAddress",
                    "moreAddresses",
                    "byEntity",
                    "moreEntities"
                  ],
                  "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/inbound-emails/{inboundEmailId}": {
      "get": {
        "operationId": "getInboundEmail",
        "summary": "Returns one inbound email with its attachments.",
        "description": "Returns one inbound email with its attachments. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "inboundEmailId",
            "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/GetInboundEmailResponse"
                }
              }
            }
          },
          "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/inbound-emails/{inboundEmailId}/handled": {
      "post": {
        "operationId": "markInboundEmailHandled",
        "summary": "Marks an inbound email as handled.",
        "description": "Marks an inbound email as handled. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "inboundEmailId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                },
                "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/GetInboundEmailResponse"
                }
              }
            }
          },
          "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/inbound-emails/{inboundEmailId}/not-a-bill": {
      "post": {
        "operationId": "markInboundEmailNotABill",
        "summary": "Marks an inbound email as not a bill.",
        "description": "Marks an inbound email as not a bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "inboundEmailId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                },
                "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/GetInboundEmailResponse"
                }
              }
            }
          },
          "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/inbound-emails/{inboundEmailId}/read-as-bill": {
      "post": {
        "operationId": "readInboundEmailAsBill",
        "summary": "Reads an inbound email as a bill and returns what it found.",
        "description": "Reads an inbound email as a bill and returns what it found. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "inboundEmailId",
            "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/GetInboundEmailResponse"
                }
              }
            }
          },
          "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/inbound-refusals": {
      "get": {
        "operationId": "listInboundRefusals",
        "summary": "Lists the inbound emails the ledger refused, with the reason for each.",
        "description": "Lists the inbound emails the ledger refused, with the reason for each. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "addressId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "reason",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Reason2"
            }
          },
          {
            "name": "senderDomain",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 253
            }
          },
          {
            "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}$"
            }
          },
          {
            "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
            }
          }
        ],
        "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"
                          },
                          "refusedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "addressId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "address": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "domain": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reason": {
                            "$ref": "#/components/schemas/Reason2"
                          },
                          "reasonLabel": {
                            "type": "string"
                          },
                          "note": {
                            "type": "string"
                          },
                          "senderDomain": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sizeBytes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "attributedToName": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "refusedAt",
                          "entityTimeZone",
                          "entityId",
                          "entityName",
                          "addressId",
                          "address",
                          "domain",
                          "reason",
                          "reasonLabel",
                          "note",
                          "senderDomain",
                          "sizeBytes",
                          "attributedToName"
                        ],
                        "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/inbox-controls/advice": {
      "post": {
        "operationId": "draftInboxPolicyAdvice",
        "summary": "Drafts advice on the inbox policy for a person to read.",
        "description": "Drafts advice on the inbox policy for a person to read. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:admin",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "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"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "windowDays": {
                      "type": "number",
                      "const": 14
                    },
                    "facts": {
                      "type": "object",
                      "properties": {
                        "windowDays": {
                          "type": "number",
                          "const": 14
                        },
                        "arrivals": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "held": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "read": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "notABill": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "stillOpen": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "refused": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "byReason": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "enum": [
                              "UNAUTHENTICATED",
                              "UNKNOWN_SENDER",
                              "SENDER_DAY_MESSAGES",
                              "ADDRESS_DAY_MESSAGES",
                              "SENDER_DAY_SPEND",
                              "ADDRESS_DAY_SPEND",
                              "OVER_DAILY_LIMIT"
                            ]
                          },
                          "additionalProperties": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "required": [
                            "UNAUTHENTICATED",
                            "UNKNOWN_SENDER",
                            "SENDER_DAY_MESSAGES",
                            "ADDRESS_DAY_MESSAGES",
                            "SENDER_DAY_SPEND",
                            "ADDRESS_DAY_SPEND",
                            "OVER_DAILY_LIMIT"
                          ]
                        },
                        "topSenders": {
                          "maxItems": 5,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "domain": {
                                "type": "string"
                              },
                              "arrivals": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "held": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "read": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "known": {
                                "type": "boolean"
                              },
                              "authenticatedAll": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "domain",
                              "arrivals",
                              "held",
                              "read",
                              "known",
                              "authenticatedAll"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "current": {
                          "$ref": "#/components/schemas/Current"
                        }
                      },
                      "required": [
                        "windowDays",
                        "arrivals",
                        "held",
                        "read",
                        "notABill",
                        "stillOpen",
                        "refused",
                        "byReason",
                        "topSenders",
                        "current"
                      ],
                      "additionalProperties": false
                    },
                    "proposal": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Current"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "because": {
                      "maxItems": 2,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "rule": {
                                "type": "string",
                                "const": "R1"
                              },
                              "domain": {
                                "type": "string"
                              },
                              "peakDayMessages": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "authenticatedAll": {
                                "type": "boolean",
                                "const": true
                              }
                            },
                            "required": [
                              "rule",
                              "domain",
                              "peakDayMessages",
                              "authenticatedAll"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "rule": {
                                "type": "string",
                                "const": "R2"
                              },
                              "releasedAuthenticatedUnknown": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "markedNotABillUnknown": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "rule",
                              "releasedAuthenticatedUnknown",
                              "markedNotABillUnknown"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "summary": {
                      "type": "string"
                    },
                    "paragraph": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string"
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "text",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "NOTHING_HELD",
                            "LIMIT_REACHED",
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNPARSABLE",
                            "REFUSED",
                            "FIGURE_INVENTED",
                            "CLAIMS_ACTION",
                            "CONTACT_DETAIL",
                            "BANKING_WORDS",
                            "PAYMENT_WORDS"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "dismissed": {
                      "type": "boolean"
                    },
                    "digest": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    }
                  },
                  "required": [
                    "windowDays",
                    "facts",
                    "proposal",
                    "because",
                    "summary",
                    "paragraph",
                    "why",
                    "dismissed",
                    "digest"
                  ],
                  "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/inbox-controls/firings": {
      "get": {
        "operationId": "listInboxControlFirings",
        "summary": "Lists the times the inbox controls fired, newest first.",
        "description": "Lists the times the inbox controls fired, newest first. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "addressId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "reason",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "UNAUTHENTICATED",
                "UNKNOWN_SENDER",
                "SENDER_DAY_MESSAGES",
                "ADDRESS_DAY_MESSAGES",
                "SENDER_DAY_SPEND",
                "ADDRESS_DAY_SPEND",
                "OVER_DAILY_LIMIT"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "HELD",
                "REFUSED"
              ]
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "HELD",
                "DECIDED"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 253
            }
          },
          {
            "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}$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "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": {
                              "kind": {
                                "type": "string",
                                "const": "HELD"
                              },
                              "id": {
                                "type": "string"
                              },
                              "at": {
                                "type": "string",
                                "minLength": 20
                              },
                              "entityId": {
                                "type": "string"
                              },
                              "entityName": {
                                "type": "string"
                              },
                              "entityTimeZone": {
                                "type": "string"
                              },
                              "addressId": {
                                "type": "string"
                              },
                              "address": {
                                "type": "string"
                              },
                              "addressLabel": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "reasonSentence": {
                                "type": "string"
                              },
                              "setBy": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "setAt": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "sizeBytes": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "senderDomain": {
                                "type": "string"
                              },
                              "reason": {
                                "type": "string",
                                "enum": [
                                  "UNAUTHENTICATED",
                                  "UNKNOWN_SENDER",
                                  "SENDER_DAY_MESSAGES",
                                  "ADDRESS_DAY_MESSAGES",
                                  "SENDER_DAY_SPEND",
                                  "ADDRESS_DAY_SPEND"
                                ]
                              },
                              "stage": {
                                "type": "string",
                                "enum": [
                                  "INTAKE",
                                  "READER"
                                ]
                              },
                              "policy": {
                                "type": "string",
                                "enum": [
                                  "ACCEPT_ALL",
                                  "QUARANTINE_UNAUTHENTICATED",
                                  "KNOWN_SENDERS_ONLY"
                                ]
                              },
                              "limit": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "measured": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "windowStart": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "inboundEmailId": {
                                "type": "string"
                              },
                              "outcome": {
                                "type": "string",
                                "enum": [
                                  "HELD",
                                  "READ",
                                  "NOT_A_BILL"
                                ]
                              },
                              "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"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "kind",
                              "id",
                              "at",
                              "entityId",
                              "entityName",
                              "entityTimeZone",
                              "addressId",
                              "address",
                              "addressLabel",
                              "reasonSentence",
                              "setBy",
                              "setAt",
                              "sizeBytes",
                              "senderDomain",
                              "reason",
                              "stage",
                              "policy",
                              "limit",
                              "measured",
                              "windowStart",
                              "inboundEmailId",
                              "outcome",
                              "decidedBy",
                              "decidedAt"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "REFUSED"
                              },
                              "id": {
                                "type": "string"
                              },
                              "at": {
                                "type": "string",
                                "minLength": 20
                              },
                              "entityId": {
                                "type": "string"
                              },
                              "entityName": {
                                "type": "string"
                              },
                              "entityTimeZone": {
                                "type": "string"
                              },
                              "addressId": {
                                "type": "string"
                              },
                              "address": {
                                "type": "string"
                              },
                              "addressLabel": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "reasonSentence": {
                                "type": "string"
                              },
                              "setBy": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "setAt": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "sizeBytes": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "senderDomain": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "reason": {
                                "type": "string",
                                "const": "OVER_DAILY_LIMIT"
                              },
                              "capKind": {
                                "type": "string",
                                "enum": [
                                  "SENDER_MESSAGES",
                                  "ADDRESS_MESSAGES",
                                  "ADDRESS_HELD_BYTES"
                                ]
                              },
                              "limit": {
                                "type": "string"
                              },
                              "measured": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "id",
                              "at",
                              "entityId",
                              "entityName",
                              "entityTimeZone",
                              "addressId",
                              "address",
                              "addressLabel",
                              "reasonSentence",
                              "setBy",
                              "setAt",
                              "sizeBytes",
                              "senderDomain",
                              "reason",
                              "capKind",
                              "limit",
                              "measured"
                            ],
                            "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/inbox-controls/preview": {
      "get": {
        "operationId": "previewInboxControls",
        "summary": "Previews the inbox controls before they are applied.",
        "description": "Previews the inbox controls before they are applied. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "senderPolicy",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "ACCEPT_ALL",
                "QUARANTINE_UNAUTHENTICATED",
                "KNOWN_SENDERS_ONLY"
              ]
            }
          },
          {
            "name": "addressDailyMessages",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5000
            }
          },
          {
            "name": "senderDailyMessages",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5000
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "default": 30,
              "type": "integer",
              "minimum": 1,
              "maximum": 90
            }
          }
        ],
        "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": {
                    "days": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "arrivals": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "wouldHold": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "truncated": {
                      "type": "boolean"
                    },
                    "byReason": {
                      "type": "object",
                      "properties": {
                        "UNAUTHENTICATED": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "UNKNOWN_SENDER": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "SENDER_DAY_MESSAGES": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "ADDRESS_DAY_MESSAGES": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "UNAUTHENTICATED",
                        "UNKNOWN_SENDER",
                        "SENDER_DAY_MESSAGES",
                        "ADDRESS_DAY_MESSAGES"
                      ],
                      "additionalProperties": false
                    },
                    "topSenders": {
                      "maxItems": 5,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "arrivals": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "wouldHold": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "known": {
                            "type": "boolean"
                          },
                          "authenticatedAll": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "domain",
                          "arrivals",
                          "wouldHold",
                          "known",
                          "authenticatedAll"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "spendNotReplayed": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "days",
                    "arrivals",
                    "wouldHold",
                    "truncated",
                    "byReason",
                    "topSenders",
                    "spendNotReplayed"
                  ],
                  "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/inbox-controls/read-held": {
      "post": {
        "operationId": "readHeldInboundEmails",
        "summary": "Reads the inbound emails the inbox controls are holding.",
        "description": "Reads the inbound emails the inbox controls are holding. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "inboundEmailIds": {
                    "minItems": 1,
                    "maxItems": 25,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": [
                  "inboundEmailIds"
                ],
                "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": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "inboundEmailId": {
                            "type": "string"
                          },
                          "outcome": {
                            "type": "string",
                            "enum": [
                              "READ",
                              "REFUSED"
                            ]
                          },
                          "sentence": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "inboundEmailId",
                          "outcome",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "results"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/inbox-reply-stops": {
      "get": {
        "operationId": "listInboxReplyStops",
        "summary": "Lists the stops on replies to senders, with the server's total.",
        "description": "Lists the stops on replies to senders, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "live",
            "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/ListInboxReplyStopsResponseItem"
                      }
                    },
                    "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": "stopInboxReplies",
        "summary": "Stops replies to a sender for a period.",
        "description": "Stops replies to a sender for a period. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recipientEmail": {
                    "type": "string",
                    "maxLength": 320,
                    "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,}$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                },
                "required": [
                  "recipientEmail",
                  "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/ListInboxReplyStopsResponseItem"
                }
              }
            }
          },
          "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/inbox-reply-stops/{stopId}/lift": {
      "post": {
        "operationId": "liftInboxReplyStop",
        "summary": "Lifts a stop on replies to a sender.",
        "description": "Lifts a stop on replies to a sender. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "stopId",
            "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": 4,
                    "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/ListInboxReplyStopsResponseItem"
                }
              }
            }
          },
          "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/intake-links": {
      "post": {
        "operationId": "createIntakeLink",
        "summary": "Creates a link a customer or vendor uses to send their details to the ledger.",
        "description": "Creates a link a customer or vendor uses to send their details to the ledger. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "expiresOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "label"
                ],
                "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/CreateIntakeLinkResponse"
                }
              }
            }
          },
          "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": "listIntakeLinks",
        "summary": "Lists the intake links, with the server's total.",
        "description": "Lists the intake links, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "CLOSED"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "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/ListIntakeLinksResponseItem"
                      }
                    },
                    "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/intake-links/{linkId}/revoke": {
      "post": {
        "operationId": "revokeIntakeLink",
        "summary": "Revokes an intake link so it can no longer be used.",
        "description": "Revokes an intake link so it can no longer be used. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "linkId",
            "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/ListIntakeLinksResponseItem"
                }
              }
            }
          },
          "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/intake-links/{linkId}/url": {
      "post": {
        "operationId": "copyIntakeLink",
        "summary": "Returns the address of an intake link so it can be copied.",
        "description": "Returns the address of an intake link so it can be copied. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "linkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "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"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateIntakeLinkResponse"
                }
              }
            }
          },
          "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/intercompany-eliminations/{intercompanyEliminationId}/void": {
      "post": {
        "operationId": "voidIntercompanyElimination",
        "summary": "Voids an elimination entry for an intercompany pair.",
        "description": "Voids an elimination entry for an intercompany pair. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "intercompanyEliminationId",
            "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/EliminationsItem"
                }
              }
            }
          },
          "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/intercompany-pairs": {
      "get": {
        "operationId": "listIntercompanyPairs",
        "summary": "Lists the intercompany pairs, with the server's total.",
        "description": "Lists the intercompany pairs, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "NO_MIRROR",
                  "MIRROR_DRAFT",
                  "MATCHED",
                  "DIFFERS",
                  "MIRROR_VOID",
                  "BILL_VOID",
                  "DECLINED"
                ]
              }
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "counterpartyEntityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "billId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invoiceId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "elimination",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "none",
                "posted",
                "stale",
                "byHand"
              ]
            }
          },
          {
            "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}$"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "billDate",
                "difference",
                "state"
              ]
            }
          }
        ],
        "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"
                          },
                          "from": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "identityHue": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "identityHue"
                            ],
                            "additionalProperties": false
                          },
                          "to": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "identityHue": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "identityHue"
                            ],
                            "additionalProperties": false
                          },
                          "bill": {
                            "$ref": "#/components/schemas/Bill"
                          },
                          "decision": {
                            "type": "string",
                            "enum": [
                              "PROPOSED",
                              "MIRRORED",
                              "DECLINED"
                            ]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "NO_MIRROR",
                              "MIRROR_DRAFT",
                              "MATCHED",
                              "DIFFERS",
                              "MIRROR_VOID",
                              "BILL_VOID",
                              "DECLINED"
                            ]
                          },
                          "reasons": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "CURRENCY",
                                "NET",
                                "TAX",
                                "WRONG_CUSTOMER",
                                "MIRROR_WRITTEN_OFF"
                              ]
                            }
                          },
                          "differences": {
                            "$ref": "#/components/schemas/Differences2"
                          },
                          "mirror": {
                            "$ref": "#/components/schemas/Mirror"
                          },
                          "mirrorHidden": {
                            "type": "boolean"
                          },
                          "mirrorHow": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "CREATED",
                                  "LINKED"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "elimination": {
                            "$ref": "#/components/schemas/Elimination"
                          },
                          "proposedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "proposedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "entityTimeZone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "from",
                          "to",
                          "bill",
                          "decision",
                          "state",
                          "reasons",
                          "differences",
                          "mirror",
                          "mirrorHidden",
                          "mirrorHow",
                          "elimination",
                          "proposedBy",
                          "proposedAt",
                          "entityTimeZone"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "enum": [
                          "NO_MIRROR",
                          "MIRROR_DRAFT",
                          "MATCHED",
                          "DIFFERS",
                          "MIRROR_VOID",
                          "BILL_VOID",
                          "DECLINED"
                        ]
                      },
                      "additionalProperties": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "required": [
                        "NO_MIRROR",
                        "MIRROR_DRAFT",
                        "MATCHED",
                        "DIFFERS",
                        "MIRROR_VOID",
                        "BILL_VOID",
                        "DECLINED"
                      ]
                    },
                    "staleEliminations": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "counts",
                    "staleEliminations"
                  ],
                  "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/intercompany-pairs/look-back": {
      "post": {
        "operationId": "intercompanyLookBack",
        "summary": "Looks back over the ledger for intercompany transactions that were not paired.",
        "description": "Looks back over the ledger for intercompany transactions that were not paired. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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
                  },
                  "after": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "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": {
                  "type": "object",
                  "properties": {
                    "examined": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "proposed": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "alreadyProposed": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "skippedConversion": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "skippedOwnCompany": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "atLimit": {
                      "type": "boolean"
                    },
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "examined",
                    "proposed",
                    "alreadyProposed",
                    "skippedConversion",
                    "skippedOwnCompany",
                    "atLimit",
                    "next"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/intercompany-pairs/{intercompanyPairId}": {
      "get": {
        "operationId": "getIntercompanyPair",
        "summary": "Returns one intercompany pair with its two sides.",
        "description": "Returns one intercompany pair with its two sides. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "intercompanyPairId",
            "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/GetIntercompanyPairResponse"
                }
              }
            }
          },
          "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/intercompany-pairs/{intercompanyPairId}/audit": {
      "get": {
        "operationId": "listIntercompanyAudit",
        "summary": "Lists the audit trail of one intercompany pair.",
        "description": "Lists the audit trail of one intercompany pair. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "intercompanyPairId",
            "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
            }
          },
          {
            "name": "group",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "decisions",
                "eliminations",
                "readings"
              ]
            }
          }
        ],
        "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/intercompany-pairs/{intercompanyPairId}/candidates": {
      "get": {
        "operationId": "listIntercompanyCandidates",
        "summary": "Lists the transactions that may pair with an intercompany pair.",
        "description": "Lists the transactions that may pair with an intercompany pair. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "intercompanyPairId",
            "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
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "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/BestCandidateOption1"
                      }
                    },
                    "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/intercompany-pairs/{intercompanyPairId}/decline": {
      "post": {
        "operationId": "declineIntercompanyPair",
        "summary": "Declines an intercompany pair with a reason.",
        "description": "Declines an intercompany pair with a reason. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "intercompanyPairId",
            "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/GetIntercompanyPairResponse"
                }
              }
            }
          },
          "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/intercompany-pairs/{intercompanyPairId}/elimination-preview": {
      "get": {
        "operationId": "previewIntercompanyElimination",
        "summary": "Previews the elimination entry for an intercompany pair.",
        "description": "Previews the elimination entry for an intercompany pair. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "intercompanyPairId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "asAt",
            "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": {
                    "pairId": {
                      "type": "string"
                    },
                    "asAt": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "today": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "currency": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "blockers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": [
                              "FUTURE",
                              "NOT_MATCHED",
                              "CURRENCY",
                              "FISCAL_YEAR",
                              "NOT_POSTED",
                              "NOT_PLAIN",
                              "OPEN_DIFFERS",
                              "NOTHING_TO_ELIMINATE"
                            ]
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "identityHue": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "identityHue"
                            ],
                            "additionalProperties": false
                          },
                          "account": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "position": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "entity",
                          "account",
                          "amountMinor",
                          "position"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "eliminatedBalanceMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "eliminatedNetMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "billOpenMinor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "invoiceOpenMinor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "digest": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 64,
                          "maxLength": 64
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "pairId",
                    "asAt",
                    "today",
                    "currency",
                    "ok",
                    "blockers",
                    "lines",
                    "eliminatedBalanceMinor",
                    "eliminatedNetMinor",
                    "billOpenMinor",
                    "invoiceOpenMinor",
                    "digest"
                  ],
                  "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/intercompany-pairs/{intercompanyPairId}/eliminations": {
      "post": {
        "operationId": "postIntercompanyElimination",
        "summary": "Posts the elimination entry for an intercompany pair.",
        "description": "Posts the elimination entry for an intercompany pair. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "intercompanyPairId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "COMPUTED"
                      },
                      "asAt": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "digest": {
                        "type": "string",
                        "minLength": 64,
                        "maxLength": 64
                      },
                      "note": {
                        "type": "string",
                        "maxLength": 500
                      }
                    },
                    "required": [
                      "kind",
                      "asAt",
                      "digest"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "BY_HAND"
                      },
                      "asAt": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "note": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      }
                    },
                    "required": [
                      "kind",
                      "asAt",
                      "note"
                    ],
                    "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/EliminationsItem"
                }
              }
            }
          },
          "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/intercompany-pairs/{intercompanyPairId}/mirror-preview": {
      "get": {
        "operationId": "previewIntercompanyMirror",
        "summary": "Previews the mirror entry for an intercompany pair before it is created.",
        "description": "Previews the mirror entry for an intercompany pair before it is created. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "intercompanyPairId",
            "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": {
                    "pairId": {
                      "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}$"
                    },
                    "customer": {
                      "type": "object",
                      "properties": {
                        "plan": {
                          "type": "string",
                          "enum": [
                            "EXISTS",
                            "WILL_BE_CREATED",
                            "NEEDS_APPROVAL",
                            "NAME_TAKEN"
                          ]
                        },
                        "id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "displayName": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "plan",
                        "id",
                        "displayName"
                      ],
                      "additionalProperties": false
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "position": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "description": {
                            "type": "string"
                          },
                          "quantity": {
                            "type": "string"
                          },
                          "netMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "accountId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "accountLabel": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "HISTORY_SAME_DESCRIPTION",
                              "ASSISTANT",
                              "HISTORY_CUSTOMER",
                              "NONE"
                            ]
                          },
                          "billable": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "position",
                          "description",
                          "quantity",
                          "netMinor",
                          "accountId",
                          "accountLabel",
                          "source",
                          "billable"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "readingState": {
                      "type": "string",
                      "enum": [
                        "OFF",
                        "NOT_NEEDED",
                        "WAITING",
                        "READ",
                        "STOPPED",
                        "FAILED"
                      ]
                    },
                    "blockers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "digest": {
                      "type": "string",
                      "minLength": 64,
                      "maxLength": 64
                    }
                  },
                  "required": [
                    "pairId",
                    "issueDate",
                    "dueDate",
                    "currency",
                    "customer",
                    "lines",
                    "readingState",
                    "blockers",
                    "digest"
                  ],
                  "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/intercompany-pairs/{intercompanyPairId}/readings": {
      "post": {
        "operationId": "readIntercompanyMirror",
        "summary": "Asks for the accounts behind an intercompany pair to be read again, and answers at once; the reading follows.",
        "description": "Asks for the accounts behind an intercompany pair to be read again, and answers at once; the reading follows. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "intercompanyPairId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "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": {
                    "attempt": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 3
                    }
                  },
                  "required": [
                    "attempt"
                  ],
                  "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/intercompany-pairs/{intercompanyPairId}/reopen": {
      "post": {
        "operationId": "reopenIntercompanyPair",
        "summary": "Reopens a declined intercompany pair.",
        "description": "Reopens a declined intercompany pair. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "intercompanyPairId",
            "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/GetIntercompanyPairResponse"
                }
              }
            }
          },
          "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/intercompany-pairs/{intercompanyPairId}/unlink": {
      "post": {
        "operationId": "unlinkIntercompanyInvoice",
        "summary": "Removes an invoice from an intercompany pair.",
        "description": "Removes an invoice from an intercompany pair. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "intercompanyPairId",
            "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/GetIntercompanyPairResponse"
                }
              }
            }
          },
          "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/jobs": {
      "get": {
        "operationId": "listJobs",
        "summary": "Lists the long-running jobs on these books, newest first, with the database's total.",
        "description": "Lists the long-running jobs on these books, newest first, with the database's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "QUEUED",
                "RUNNING",
                "CANCELLING",
                "STALLED",
                "SUCCEEDED",
                "FAILED",
                "CANCELLED"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "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"
              ]
            }
          },
          {
            "name": "mine",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Job"
                      }
                    },
                    "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/jobs/bulk-operations": {
      "post": {
        "operationId": "startBulkOperation",
        "summary": "Applies one idempotent write operation to up to 5,000 records as a job, each through its own single path.",
        "description": "Applies one idempotent write operation to up to 5,000 records as a job, each through its own single path. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "operation": {
                    "type": "string",
                    "minLength": 1
                  },
                  "items": {
                    "minItems": 1,
                    "maxItems": 5000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "params": {
                          "default": {},
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "input": {
                          "description": "The request body of the operation named in operation, exactly as that operation's own entry in this contract gives it.",
                          "x-open-by-reference": true
                        }
                      },
                      "required": [
                        "input"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                },
                "required": [
                  "operation",
                  "items",
                  "label"
                ],
                "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/jobs/{jobId}": {
      "get": {
        "operationId": "getJob",
        "summary": "Returns one long-running job with its state, its progress and what it made, and can wait for it to change.",
        "description": "Returns one long-running job with its state, its progress and what it made, and can wait for it to change. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "waitMs",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "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": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "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/jobs/{jobId}/cancel": {
      "post": {
        "operationId": "cancelJob",
        "summary": "Asks a running job to stop at its next step, keeping what it has already written.",
        "description": "Asks a running job to stop at its next step, keeping what it has already written. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "jobId",
            "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
                  }
                },
                "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/Job"
                }
              }
            }
          },
          "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/jobs/{jobId}/items": {
      "get": {
        "operationId": "listJobItems",
        "summary": "Lists the items of a bulk job with the outcome of each, one page at a time.",
        "description": "Lists the items of a bulk job with the outcome of each, one page at a time. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "jobId",
            "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
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "SUCCEEDED",
                "FAILED",
                "SKIPPED"
              ]
            }
          }
        ],
        "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": {
                          "ordinal": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "operation": {
                            "type": "string"
                          },
                          "params": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "PENDING",
                              "SUCCEEDED",
                              "FAILED",
                              "SKIPPED"
                            ]
                          },
                          "recordId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "error": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "$ref": "#/components/schemas/Code"
                                  },
                                  "message": {
                                    "type": "string"
                                  },
                                  "remedy": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "message",
                                  "remedy"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "ordinal",
                          "operation",
                          "params",
                          "state",
                          "recordId",
                          "error"
                        ],
                        "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/jobs/{jobId}/pause": {
      "post": {
        "operationId": "pauseJob",
        "summary": "Stops a running job where it stands so it can be resumed later, keeping what it has already written.",
        "description": "Stops a running job where it stands so it can be resumed later, keeping what it has already written. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "round": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "nextStep": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "failedWith": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  }
                },
                "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/Job"
                }
              }
            }
          },
          "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/jobs/{jobId}/reinstate": {
      "post": {
        "operationId": "reinstateJob",
        "summary": "Takes back a job's cancellation: withdraws it while it waits, or starts the stopped work again once it was carried out.",
        "description": "Takes back a job's cancellation: withdraws it while it waits, or starts the stopped work again once it was carried out. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "failedWith": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  }
                },
                "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/Job"
                }
              }
            }
          },
          "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/jobs/{jobId}/resume": {
      "post": {
        "operationId": "resumeJob",
        "summary": "Resumes a failed job from its last checkpoint, as the person who started it.",
        "description": "Resumes a failed job from its last checkpoint, as the person who started it. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "jobId",
            "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/Job"
                }
              }
            }
          },
          "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/list-views/draft": {
      "post": {
        "operationId": "draftPurchasesListView",
        "summary": "Drafts a purchases list view from the description a person gives.",
        "description": "Drafts a purchases list view from the description a person gives. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:read",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "list": {
                    "$ref": "#/components/schemas/List"
                  },
                  "sentence": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 300
                  }
                },
                "required": [
                  "list",
                  "sentence"
                ],
                "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": {
                    "drafted": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "readBy": {
                              "type": "string",
                              "enum": [
                                "PRODUCT",
                                "MODEL"
                              ]
                            },
                            "promptVersion": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "params": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "type": "string"
                              }
                            },
                            "chips": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "valueWords": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "name",
                                  "label",
                                  "valueWords"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "vendorPhraseUnresolved": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "adjusted": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "field": {
                                    "type": "string"
                                  },
                                  "sentence": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "field",
                                  "sentence"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "quote": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "readBy",
                            "promptVersion",
                            "params",
                            "chips",
                            "vendorPhraseUnresolved",
                            "adjusted",
                            "quote"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "MODEL_FAILED",
                            "NOT_A_LIST_VIEW",
                            "NOT_FROM_LIST",
                            "FIGURE_NOT_IN_SENTENCE",
                            "READING_BUSY",
                            "LIST_TOO_LONG"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "drafted",
                    "why"
                  ],
                  "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/mcp-executions": {
      "get": {
        "operationId": "listMcpExecutions",
        "summary": "Lists the programs connected apps ran on a ledger, newest first, with the calls each one made.",
        "description": "Lists the programs connected apps ran on a ledger, newest first, with the calls each one made. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "appId",
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListMcpExecutionsResponseItem"
                      }
                    },
                    "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/mcp-executions/{executionId}": {
      "get": {
        "operationId": "getMcpExecution",
        "summary": "Reads one program a connected app ran on a ledger, with the calls it made.",
        "description": "Reads one program a connected app ran on a ledger, with the calls it made. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "executionId",
            "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/ListMcpExecutionsResponseItem"
                }
              }
            }
          },
          "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/metrics": {
      "get": {
        "operationId": "ledgerMetrics",
        "summary": "Returns the ledger's operating metrics for the period chosen.",
        "description": "Returns the ledger's operating metrics for the period chosen. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "year",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 2000,
              "maximum": 2100
            }
          },
          {
            "name": "month",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          }
        ],
        "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"
                    },
                    "timeZone": {
                      "type": "string"
                    },
                    "periodYear": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "periodMonth": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "periodLabel": {
                      "type": "string"
                    },
                    "asOf": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "close": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "enum": [
                            "NOT_ENDED",
                            "OPEN",
                            "CLOSED"
                          ]
                        },
                        "periodEnd": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "daysInClose": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "dayOfClose": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "endedAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 20
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "endedBy": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "LOCK",
                                "CLOSED_AT"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "startedAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 20
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "trend": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "periodYear": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "periodMonth": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "label": {
                                "type": "string"
                              },
                              "periodEnd": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "daysInClose": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "endedAt": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "endedBy": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "LOCK",
                                      "CLOSED_AT"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "periodYear",
                              "periodMonth",
                              "label",
                              "periodEnd",
                              "daysInClose",
                              "endedAt",
                              "endedBy"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "autoCompleted": {
                          "$ref": "#/components/schemas/Acceptance"
                        },
                        "taskCount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "cycleTimes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "derived": {
                                "type": "boolean"
                              },
                              "days": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "completedAt": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "kind",
                              "title",
                              "status",
                              "derived",
                              "days",
                              "completedAt"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "state",
                        "periodEnd",
                        "daysInClose",
                        "dayOfClose",
                        "endedAt",
                        "endedBy",
                        "startedAt",
                        "trend",
                        "autoCompleted",
                        "taskCount",
                        "cycleTimes"
                      ],
                      "additionalProperties": false
                    },
                    "queue": {
                      "$ref": "#/components/schemas/Queue"
                    },
                    "rules": {
                      "type": "object",
                      "properties": {
                        "firings": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "outcome": {
                                "type": "string"
                              },
                              "count": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "outcome",
                              "count"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "autoApproved": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "totalMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "currency": {
                              "type": "string"
                            },
                            "withoutEntry": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "count",
                            "totalMinor",
                            "currency",
                            "withoutEntry"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "firings",
                        "total",
                        "autoApproved"
                      ],
                      "additionalProperties": false
                    },
                    "spend": {
                      "type": "object",
                      "properties": {
                        "calls": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "costMicroCad": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "byFeature": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "feature": {
                                "type": "string"
                              },
                              "calls": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "costMicroCad": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              }
                            },
                            "required": [
                              "feature",
                              "calls",
                              "costMicroCad"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "featuresMore": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "callsWithoutCost": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "calls",
                        "costMicroCad",
                        "byFeature",
                        "featuresMore",
                        "callsWithoutCost"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "entityId",
                    "entityName",
                    "timeZone",
                    "periodYear",
                    "periodMonth",
                    "periodLabel",
                    "asOf",
                    "close",
                    "queue",
                    "rules",
                    "spend"
                  ],
                  "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/metrics/ai/prompt-versions": {
      "get": {
        "operationId": "promptVersionsReport",
        "summary": "Lists the prompt versions the ledger's assistant has used and how often.",
        "description": "Lists the prompt versions the ledger's assistant has used and how often. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
            }
          },
          {
            "name": "feature",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "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": {
                          "feature": {
                            "type": "string"
                          },
                          "promptName": {
                            "type": "string"
                          },
                          "promptVersion": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "calls": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "succeeded": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "retried": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "meanLatencyMs": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "spendMicroCad": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "firstSeen": {
                            "type": "string",
                            "minLength": 20
                          },
                          "lastSeen": {
                            "type": "string",
                            "minLength": 20
                          },
                          "proposals": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "total": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "approvedAsProposed": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "edited": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "declined": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "pending": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "expired": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "total",
                                  "approvedAsProposed",
                                  "edited",
                                  "declined",
                                  "pending",
                                  "expired"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "feature",
                          "promptName",
                          "promptVersion",
                          "calls",
                          "succeeded",
                          "retried",
                          "meanLatencyMs",
                          "spendMicroCad",
                          "firstSeen",
                          "lastSeen",
                          "proposals"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "month": {
                      "type": "string",
                      "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                    },
                    "zone": {
                      "type": "string"
                    },
                    "readAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "features": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "month",
                    "zone",
                    "readAt",
                    "features"
                  ],
                  "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/migration-readings/{readingId}": {
      "get": {
        "operationId": "getMigrationReading",
        "summary": "Returns one migration reading with its figures.",
        "description": "Returns one migration reading with its figures. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "readingId",
            "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/ListMigrationReadingsResponseItem"
                }
              }
            }
          },
          "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/migration-readings/{readingId}/assistant": {
      "post": {
        "operationId": "runMigrationAssistant",
        "summary": "Runs the migration assistant on a reading's open findings.",
        "description": "Runs the migration assistant on a reading's open findings. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "readingId",
            "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": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "readingId": {
                      "type": "string"
                    },
                    "requestedBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "requestedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "pair": {
                      "$ref": "#/components/schemas/Pair"
                    },
                    "note": {
                      "$ref": "#/components/schemas/Pair"
                    },
                    "findingsWritten": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "readingId",
                    "requestedBy",
                    "requestedAt",
                    "pair",
                    "note",
                    "findingsWritten",
                    "entityTimeZone"
                  ],
                  "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/migration-readings/{readingId}/findings": {
      "get": {
        "operationId": "listMigrationFindings",
        "summary": "Lists the findings of one migration reading.",
        "description": "Lists the findings of one migration reading. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "readingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cause",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Cause"
            }
          },
          {
            "name": "severity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NEEDS_LOOK",
                "FYI"
              ]
            }
          },
          {
            "name": "proposal",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "waiting",
                "decided"
              ]
            }
          },
          {
            "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/ListMigrationFindingsResponseItem"
                      }
                    },
                    "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/migration-readings/{readingId}/findings/{findingId}/accept": {
      "post": {
        "operationId": "acceptMigrationFinding",
        "summary": "Accepts a migration finding as explained.",
        "description": "Accepts a migration finding as explained. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "readingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "findingId",
            "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/ListMigrationFindingsResponseItem"
                }
              }
            }
          },
          "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/migration-readings/{readingId}/findings/{findingId}/change": {
      "post": {
        "operationId": "changeMigrationFinding",
        "summary": "Changes a migration finding to a different treatment.",
        "description": "Changes a migration finding to a different treatment. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "readingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "findingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "class": {
                        "type": "string",
                        "enum": [
                          "TIMING",
                          "CLASSIFICATION",
                          "TAX_TREATMENT",
                          "MISSING_SOURCE",
                          "OUR_DEFECT",
                          "THEIR_DEFECT",
                          "UNEXPLAINED"
                        ]
                      },
                      "explanation": {
                        "type": "string",
                        "minLength": 3,
                        "maxLength": 500
                      }
                    },
                    "required": [
                      "class",
                      "explanation"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "enum": [
                          "PAID_OR_PART_PAID",
                          "CREDIT_OR_ADJUSTMENT",
                          "DISPUTED_OR_ON_HOLD",
                          "DUPLICATE_OF_ANOTHER",
                          "INACTIVE_OR_CLOSED",
                          "MERGED_OR_RENAMED",
                          "NOTHING_STATED"
                        ]
                      }
                    },
                    "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/ListMigrationFindingsResponseItem"
                }
              }
            }
          },
          "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/migration-readings/{readingId}/findings/{findingId}/decline": {
      "post": {
        "operationId": "declineMigrationFinding",
        "summary": "Declines a migration finding with a reason.",
        "description": "Declines a migration finding with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "readingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "findingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "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/ListMigrationFindingsResponseItem"
                }
              }
            }
          },
          "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/month-end-commentaries": {
      "post": {
        "operationId": "readMonthEndCommentary",
        "summary": "Reads the month end commentary a person is writing.",
        "description": "Reads the month end commentary a person is writing. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "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
                  },
                  "periodYear": {
                    "type": "integer",
                    "minimum": 2000,
                    "maximum": 2100
                  },
                  "periodMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "cutOffDays": {
                    "default": 45,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 400
                  },
                  "replaces": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "entityId",
                  "periodYear",
                  "periodMonth"
                ],
                "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/ReadMonthEndCommentaryResponse"
                }
              }
            }
          },
          "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": "listMonthEndCommentaries",
        "summary": "Lists the month end commentaries, with the server's total.",
        "description": "Lists the month end commentaries, with the server's total. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "APPROVED",
                "SUPERSEDED"
              ]
            }
          },
          {
            "name": "periodYear",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 2000,
              "maximum": 2100
            }
          },
          {
            "name": "periodMonth",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "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/Commentary"
                      }
                    },
                    "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/month-end-commentaries/{monthEndCommentaryId}": {
      "get": {
        "operationId": "getMonthEndCommentary",
        "summary": "Returns one month end commentary.",
        "description": "Returns one month end commentary. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "monthEndCommentaryId",
            "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/ReadMonthEndCommentaryResponse"
                }
              }
            }
          },
          "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/month-end-commentaries/{monthEndCommentaryId}/approve": {
      "post": {
        "operationId": "approveMonthEndCommentary",
        "summary": "Approves a month end commentary.",
        "description": "Approves a month end commentary. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "monthEndCommentaryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "decisions": {
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "sectionKey": {
                          "type": "string",
                          "enum": [
                            "AGEING",
                            "UNEXPLAINED",
                            "VENDORS",
                            "ACCOUNTS",
                            "EXCEPTIONS"
                          ]
                        },
                        "sentenceId": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 300
                        }
                      },
                      "required": [
                        "sectionKey",
                        "sentenceId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "decisions"
                ],
                "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/ReadMonthEndCommentaryResponse"
                }
              }
            }
          },
          "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/month-end-commentaries/{monthEndCommentaryId}/draft": {
      "post": {
        "operationId": "draftMonthEndCommentary",
        "summary": "Drafts the commentary for one month end.",
        "description": "Drafts the commentary for one month end. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "monthEndCommentaryId",
            "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": {
                    "drafted": {
                      "type": "boolean"
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNPARSABLE",
                            "REFUSED",
                            "FIGURE_NOT_HELD",
                            "NO_CITATION",
                            "UNKNOWN_SECTION",
                            "UNKNOWN_FIGURE",
                            "TOO_MANY",
                            "DIRECTION_CONFLICT"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "proposed": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "ruleKept": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "leftToYou": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "AGEING",
                          "UNEXPLAINED",
                          "VENDORS",
                          "ACCOUNTS",
                          "EXCEPTIONS"
                        ]
                      }
                    },
                    "attempts": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 3
                    }
                  },
                  "required": [
                    "drafted",
                    "why",
                    "proposed",
                    "ruleKept",
                    "leftToYou",
                    "attempts"
                  ],
                  "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/openapi.json": {
      "get": {
        "operationId": "exportOpenApiDocument",
        "summary": "Returns the API's OpenAPI document with this ledger's custom objects and custom fields added.",
        "description": "Returns the API's OpenAPI document with this ledger's custom objects and custom fields added. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {},
                  "description": "An OpenAPI 3.1 document: the published contract at `/v1/openapi.json` without a credential, plus this ledger's custom operations.",
                  "x-open-by-reference": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/operation-proposals": {
      "get": {
        "operationId": "listOperationProposals",
        "summary": "Lists the operation proposals waiting for a decision, or already decided, oldest first.",
        "description": "Lists the operation proposals waiting for a decision, or already decided, oldest first. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "default": "PENDING",
              "type": "string",
              "enum": [
                "PENDING",
                "DECIDED"
              ]
            }
          },
          {
            "name": "entityId",
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListOperationProposalsResponseItem"
                      }
                    },
                    "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/operation-proposals/{proposalId}/decline": {
      "post": {
        "operationId": "declineOperationProposal",
        "summary": "Declines a proposal that an agent made, with the reason the approver gives.",
        "description": "Declines a proposal that an agent made, with the reason the approver gives. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "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": 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": {
                    "proposal": {
                      "$ref": "#/components/schemas/ListOperationProposalsResponseItem"
                    },
                    "ran": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "operation": {
                              "type": "string"
                            },
                            "targetType": {
                              "type": "string"
                            },
                            "targetId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "operation",
                            "targetType",
                            "targetId"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "note": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "proposal",
                    "ran",
                    "note"
                  ],
                  "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/originator-changes": {
      "get": {
        "operationId": "listOriginatorChanges",
        "summary": "Lists the proposed changes to bank account originator details.",
        "description": "Lists the proposed changes to bank account originator details. Needs the `ledger:read-sensitive` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read-sensitive",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "financialAccountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PROPOSED",
                "VERIFIED",
                "REJECTED",
                "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": {
                          "id": {
                            "type": "string"
                          },
                          "financialAccountId": {
                            "type": "string"
                          },
                          "accountName": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "originatorId": {
                            "type": "string"
                          },
                          "shortName": {
                            "type": "string"
                          },
                          "longName": {
                            "type": "string"
                          },
                          "destinationDataCentre": {
                            "type": "string"
                          },
                          "carriedOver": {
                            "type": "boolean"
                          },
                          "evidence": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "documentId": {
                                    "type": "string"
                                  },
                                  "fileName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "documentId",
                                  "fileName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "proposedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "proposedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "PROPOSED",
                              "VERIFIED",
                              "REJECTED",
                              "WITHDRAWN"
                            ]
                          },
                          "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"
                              }
                            ]
                          },
                          "verificationMethod": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "CALLBACK_KNOWN_NUMBER",
                                  "IN_PERSON",
                                  "OTHER"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "decisionNote": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "financialAccountId",
                          "accountName",
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "originatorId",
                          "shortName",
                          "longName",
                          "destinationDataCentre",
                          "carriedOver",
                          "evidence",
                          "proposedBy",
                          "proposedAt",
                          "status",
                          "decidedBy",
                          "decidedAt",
                          "verificationMethod",
                          "decisionNote"
                        ],
                        "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/packs": {
      "get": {
        "operationId": "listPacks",
        "summary": "Lists the packs of reports produced for a period, with the server's total.",
        "description": "Lists the packs of reports produced for a period, with the server's total. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements: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
            }
          },
          {
            "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": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "periodYear": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "periodMonth": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "periodLabel": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "FINAL"
                            ]
                          },
                          "sha256": {
                            "type": "string"
                          },
                          "fileName": {
                            "type": "string"
                          },
                          "producedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "producedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "latest": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "entityName",
                          "periodYear",
                          "periodMonth",
                          "periodLabel",
                          "status",
                          "sha256",
                          "fileName",
                          "producedBy",
                          "producedAt",
                          "latest"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "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
                }
              }
            }
          },
          "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": "producePack",
        "summary": "Produces a pack of reports for a period.",
        "description": "Produces a pack of reports for a period. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "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
                  },
                  "periodYear": {
                    "type": "integer",
                    "minimum": 2000,
                    "maximum": 2100
                  },
                  "periodMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "commentary": {
                    "type": "string",
                    "maxLength": 4000
                  },
                  "notes": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "heading": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "text": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 2000
                        }
                      },
                      "required": [
                        "heading",
                        "text"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "entityId",
                  "periodYear",
                  "periodMonth"
                ],
                "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/ProducePackResponse"
                }
              }
            }
          },
          "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/packs/{packId}": {
      "get": {
        "operationId": "getPack",
        "summary": "Returns one pack with its contents.",
        "description": "Returns one pack with its contents. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "packId",
            "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/ProducePackResponse"
                }
              }
            }
          },
          "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/parallel-run/months": {
      "get": {
        "operationId": "listParallelRunMonths",
        "summary": "Lists the months in a parallel run against a second system.",
        "description": "Lists the months in a parallel run against a second system. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements: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": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "periodYear": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "periodMonth": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "periodLabel": {
                            "type": "string"
                          },
                          "periodEnd": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "OPEN",
                              "CLEAN",
                              "NOT_CLEAN"
                            ]
                          },
                          "partnerSystem": {
                            "type": "string"
                          },
                          "partnerClosedOn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "partnerCloseDays": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "ourCloseDays": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "recordedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "recordedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "signedOffBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "signedOffAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "differencesByClass": {
                            "$ref": "#/components/schemas/DifferencesByClass"
                          },
                          "unclassifiedDifferences": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "entityName",
                          "periodYear",
                          "periodMonth",
                          "periodLabel",
                          "periodEnd",
                          "status",
                          "partnerSystem",
                          "partnerClosedOn",
                          "partnerCloseDays",
                          "ourCloseDays",
                          "recordedBy",
                          "recordedAt",
                          "signedOffBy",
                          "signedOffAt",
                          "differencesByClass",
                          "unclassifiedDifferences",
                          "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"
          }
        }
      },
      "post": {
        "operationId": "recordParallelRunMonth",
        "summary": "Records a month of parallel-run figures from this ledger.",
        "description": "Records a month of parallel-run figures from this ledger. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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
                  },
                  "periodYear": {
                    "type": "integer",
                    "minimum": 2000,
                    "maximum": 2100
                  },
                  "periodMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "partnerSystem": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "partnerClosedOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "note": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "entityId",
                  "periodYear",
                  "periodMonth",
                  "partnerSystem"
                ],
                "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/GetParallelRunMonthResponse"
                }
              }
            }
          },
          "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/parallel-run/months/{monthId}": {
      "get": {
        "operationId": "getParallelRunMonth",
        "summary": "Returns one month of a parallel run with its lines and its differences.",
        "description": "Returns one month of a parallel run with its lines and its differences. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "monthId",
            "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
            }
          },
          {
            "name": "comparison",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "CLOSE_TIME",
                "TRIAL_BALANCE",
                "STATEMENT",
                "RETURN",
                "PAYABLES"
              ]
            }
          }
        ],
        "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/GetParallelRunMonthResponse"
                }
              }
            }
          },
          "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/parallel-run/months/{monthId}/lines/{lineId}": {
      "patch": {
        "operationId": "classifyParallelRunLine",
        "summary": "Classifies one parallel-run difference as explained or open.",
        "description": "Classifies one parallel-run difference as explained or open. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "monthId",
            "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": {
                  "class": {
                    "type": "string",
                    "enum": [
                      "TIMING",
                      "CLASSIFICATION",
                      "TAX_TREATMENT",
                      "MISSING_SOURCE",
                      "OUR_DEFECT",
                      "THEIR_DEFECT",
                      "UNEXPLAINED"
                    ]
                  },
                  "explanation": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "proposalId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "class",
                  "explanation"
                ],
                "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/GetParallelRunMonthResponse"
                }
              }
            }
          },
          "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/parallel-run/months/{monthId}/payables": {
      "post": {
        "operationId": "compareParallelRunPayables",
        "summary": "Compares the payables of a parallel-run month with the other system.",
        "description": "Compares the payables of a parallel-run month with the other system. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "monthId",
            "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/GetParallelRunMonthResponse"
                }
              }
            }
          },
          "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/parallel-run/months/{monthId}/proposals": {
      "post": {
        "operationId": "proposeParallelRunPayables",
        "summary": "Proposes the payables a parallel run should show, for a person to decide.",
        "description": "Proposes the payables a parallel run should show, for a person to decide. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "monthId",
            "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": {
                  "type": "object",
                  "properties": {
                    "examined": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "leftForYou": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "alreadyProposed": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "proposed": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "byBasis": {
                      "type": "object",
                      "properties": {
                        "rule": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "model": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "rule",
                        "model"
                      ],
                      "additionalProperties": false
                    },
                    "pairs": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "nothingMatched": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "ambiguous": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "evidenceNotKept": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "hiddenAfterDecline": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "modelWhy": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNPARSABLE",
                            "REFUSED",
                            "UNKNOWN_REF",
                            "STOPPED_AFTER_THREE_DECLINES"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "modelPairsLeftOut": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "examined",
                    "leftForYou",
                    "alreadyProposed",
                    "proposed",
                    "byBasis",
                    "pairs",
                    "nothingMatched",
                    "ambiguous",
                    "evidenceNotKept",
                    "hiddenAfterDecline",
                    "modelWhy",
                    "modelPairsLeftOut"
                  ],
                  "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"
          }
        }
      },
      "get": {
        "operationId": "listParallelRunProposals",
        "summary": "Lists the proposals raised by a parallel run for one month.",
        "description": "Lists the proposals raised by a parallel run for one month. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "monthId",
            "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
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "default": "ALL",
              "type": "string",
              "enum": [
                "WAITING",
                "OUT_OF_DATE",
                "SET_BY_HAND",
                "ACCEPTED",
                "EDITED",
                "DECLINED",
                "ALL"
              ]
            }
          }
        ],
        "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/ProposalOption1"
                      }
                    },
                    "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/parallel-run/months/{monthId}/proposals/{parallelRunProposalId}/accept": {
      "post": {
        "operationId": "acceptParallelRunProposal",
        "summary": "Accepts a parallel-run proposal, which applies its change.",
        "description": "Accepts a parallel-run proposal, which applies its change. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "monthId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "parallelRunProposalId",
            "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/GetParallelRunMonthResponse"
                }
              }
            }
          },
          "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/parallel-run/months/{monthId}/proposals/{parallelRunProposalId}/decline": {
      "post": {
        "operationId": "declineParallelRunProposal",
        "summary": "Declines a parallel-run proposal with a reason.",
        "description": "Declines a parallel-run proposal with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "monthId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "parallelRunProposalId",
            "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/GetParallelRunMonthResponse"
                }
              }
            }
          },
          "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/parallel-run/months/{monthId}/sign-off": {
      "post": {
        "operationId": "signOffParallelRunMonth",
        "summary": "Signs off one parallel-run month as matching or explained.",
        "description": "Signs off one parallel-run month as matching or explained. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "monthId",
            "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"
                      }
                    ]
                  },
                  "partnerClosedOn": {
                    "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/GetParallelRunMonthResponse"
                }
              }
            }
          },
          "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/parallel-run/months/{monthId}/theirs": {
      "post": {
        "operationId": "importPartnerFigures",
        "summary": "Imports the figures the other system produced for one parallel-run month.",
        "description": "Imports the figures the other system produced for one parallel-run month. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "monthId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "csv": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 524288
                  },
                  "defaultComparison": {
                    "type": "string",
                    "const": "PAYABLES"
                  }
                },
                "required": [
                  "csv"
                ],
                "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/GetParallelRunMonthResponse"
                }
              }
            }
          },
          "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/payables-ageing": {
      "get": {
        "operationId": "getPayablesAgeing",
        "summary": "Returns the payables ageing of the ledger.",
        "description": "Returns the payables ageing of the ledger. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements: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
            }
          },
          {
            "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": "vendor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            }
          }
        ],
        "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": {
                          "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+$"
                          },
                          "held": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "total": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "key": {
                            "type": "string"
                          },
                          "vendor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  },
                                  "paymentHold": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName",
                                  "paymentHold"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "supplierNames": {
                            "maxItems": 3,
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "supplierCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "billCount": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "heldBillCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "oldestDueDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "daysLate": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "current",
                          "d1to30",
                          "d31to60",
                          "d61to90",
                          "over90",
                          "held",
                          "total",
                          "key",
                          "vendor",
                          "supplierNames",
                          "supplierCount",
                          "billCount",
                          "heldBillCount",
                          "oldestDueDate",
                          "daysLate"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "asOf": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "entity": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "timeZone": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "timeZone"
                      ],
                      "additionalProperties": false
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "totals": {
                      "$ref": "#/components/schemas/Totals4"
                    },
                    "openBillCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "heldBillCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "tie": {
                      "$ref": "#/components/schemas/TieOption1"
                    },
                    "filteredTotals": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/FilteredTotalsOption1"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "asOf",
                    "entity",
                    "currency",
                    "totals",
                    "openBillCount",
                    "heldBillCount",
                    "tie",
                    "filteredTotals"
                  ],
                  "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/payables-ageing/bills": {
      "get": {
        "operationId": "listPayablesAgeingBills",
        "summary": "Lists the bills that make up the payables ageing.",
        "description": "Lists the bills that make up the payables ageing. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements: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
            }
          },
          {
            "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": "vendor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            }
          },
          {
            "name": "column",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "current",
                "d1to30",
                "d31to60",
                "d61to90",
                "over90",
                "held"
              ]
            }
          }
        ],
        "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": {
                          "billId": {
                            "type": "string"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "supplierName": {
                            "type": "string"
                          },
                          "vendor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "billDate": {
                            "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+$"
                          },
                          "openMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "functionalOpenMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "column": {
                            "type": "string",
                            "enum": [
                              "current",
                              "d1to30",
                              "d31to60",
                              "d61to90",
                              "over90",
                              "held"
                            ]
                          },
                          "daysLate": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "hold": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "reason": {
                                    "type": "string"
                                  },
                                  "heldAt": {
                                    "type": "string"
                                  },
                                  "heldBy": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "heldUntil": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "byPolicy": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "reason",
                                  "heldAt",
                                  "heldBy",
                                  "heldUntil",
                                  "byPolicy"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "billId",
                          "number",
                          "supplierName",
                          "vendor",
                          "billDate",
                          "dueDate",
                          "currency",
                          "totalMinor",
                          "openMinor",
                          "functionalOpenMinor",
                          "column",
                          "daysLate",
                          "hold"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "asOf": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "entity": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "timeZone": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "timeZone"
                      ],
                      "additionalProperties": false
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "vendorLabel": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "asOf",
                    "entity",
                    "currency",
                    "vendorLabel"
                  ],
                  "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/payables-ageing/tie": {
      "get": {
        "operationId": "getPayablesTie",
        "summary": "Returns how the payables ageing ties to the general ledger.",
        "description": "Returns how the payables ageing ties to the general ledger. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "accountId",
            "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}$"
            }
          }
        ],
        "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": {
                    "rows": {
                      "$ref": "#/components/schemas/Rows3"
                    }
                  },
                  "required": [
                    "rows"
                  ],
                  "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/payables-ageing/unexplained": {
      "get": {
        "operationId": "listPayablesUnexplained",
        "summary": "Lists the payables differences the ageing cannot explain yet.",
        "description": "Lists the payables differences the ageing cannot explain yet. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements: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
            }
          },
          {
            "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": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "MANUAL",
                "AGENT_PROPOSAL",
                "RECURRING",
                "REVERSAL",
                "IMPORT",
                "CHAT",
                "MIGRATION",
                "PAYMENT_RUN",
                "INVOICE",
                "RECEIPT",
                "BILL",
                "BILL_SETTLEMENT",
                "VENDOR_CREDIT"
              ]
            }
          },
          {
            "name": "side",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ADDED",
                "TAKEN_OFF"
              ]
            }
          }
        ],
        "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": {
                          "lineId": {
                            "type": "string"
                          },
                          "entry": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "entryNumber": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "entryDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "memo": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "sourceKind": {
                                "type": "string",
                                "enum": [
                                  "MANUAL",
                                  "AGENT_PROPOSAL",
                                  "RECURRING",
                                  "REVERSAL",
                                  "IMPORT",
                                  "CHAT",
                                  "MIGRATION",
                                  "PAYMENT_RUN",
                                  "INVOICE",
                                  "RECEIPT",
                                  "BILL",
                                  "BILL_SETTLEMENT",
                                  "VENDOR_CREDIT"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "DRAFT",
                                  "PROPOSED",
                                  "IN_REVIEW",
                                  "APPROVED",
                                  "POSTED",
                                  "DECLINED",
                                  "REVERSED"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "entryNumber",
                              "entryDate",
                              "memo",
                              "sourceKind",
                              "status"
                            ],
                            "additionalProperties": false
                          },
                          "account": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "payableMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "lineId",
                          "entry",
                          "account",
                          "payableMinor",
                          "currency",
                          "amountMinor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "asOf": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "entity": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "timeZone": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "timeZone"
                      ],
                      "additionalProperties": false
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "unexplainedMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "groups": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "sourceKind": {
                            "type": "string",
                            "enum": [
                              "MANUAL",
                              "AGENT_PROPOSAL",
                              "RECURRING",
                              "REVERSAL",
                              "IMPORT",
                              "CHAT",
                              "MIGRATION",
                              "PAYMENT_RUN",
                              "INVOICE",
                              "RECEIPT",
                              "BILL",
                              "BILL_SETTLEMENT",
                              "VENDOR_CREDIT"
                            ]
                          },
                          "reversedPair": {
                            "type": "boolean"
                          },
                          "side": {
                            "type": "string",
                            "enum": [
                              "ADDED",
                              "TAKEN_OFF"
                            ]
                          },
                          "lineCount": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "payableMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "sourceKind",
                          "reversedPair",
                          "side",
                          "lineCount",
                          "payableMinor"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "asOf",
                    "entity",
                    "currency",
                    "unexplainedMinor",
                    "groups"
                  ],
                  "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/payment-plans": {
      "post": {
        "operationId": "createPaymentPlan",
        "summary": "Proposes a payment plan for a bill or a set of bills.",
        "description": "Proposes a payment plan for a bill or a set of bills. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "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
                  },
                  "financialAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "window": {
                    "$ref": "#/components/schemas/WindowOption1"
                  },
                  "keepMinor": {
                    "default": "0",
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "constraints": {
                    "type": "object",
                    "properties": {
                      "notBefore": {
                        "maxItems": 5,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "vendorId": {
                              "type": "string",
                              "minLength": 1
                            },
                            "on": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            }
                          },
                          "required": [
                            "vendorId",
                            "on"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "leaveOut": {
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "vendorId": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "vendorId"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "includeDeclined": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "notBefore",
                      "leaveOut",
                      "includeDeclined"
                    ],
                    "additionalProperties": false
                  },
                  "readBy": {
                    "default": "FORM",
                    "type": "string",
                    "enum": [
                      "FORM",
                      "PRODUCT",
                      "MODEL"
                    ]
                  },
                  "promptVersion": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  }
                },
                "required": [
                  "entityId",
                  "financialAccountId",
                  "window",
                  "constraints"
                ],
                "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/CreatePaymentPlanResponse"
                }
              }
            }
          },
          "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/payment-plans/read-sentence": {
      "post": {
        "operationId": "readPaymentPlanSentence",
        "summary": "Reads the sentence that describes a payment plan.",
        "description": "Reads the sentence that describes a payment plan. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "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
                  },
                  "sentence": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 300
                  }
                },
                "required": [
                  "entityId",
                  "sentence"
                ],
                "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": {
                    "drafted": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "readBy": {
                              "type": "string",
                              "enum": [
                                "PRODUCT",
                                "MODEL"
                              ]
                            },
                            "promptVersion": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "window": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/WindowOption1"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "keepMinor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "notBefore": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "phrase": {
                                    "type": "string"
                                  },
                                  "vendor": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "displayName": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "displayName"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "on": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  }
                                },
                                "required": [
                                  "phrase",
                                  "vendor",
                                  "on"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "leaveOut": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "phrase": {
                                    "type": "string"
                                  },
                                  "vendor": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "displayName": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "displayName"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "phrase",
                                  "vendor"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "includeDeclined": {
                              "type": "boolean"
                            },
                            "adjusted": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "field": {
                                    "type": "string"
                                  },
                                  "sentence": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "field",
                                  "sentence"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "quote": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "readBy",
                            "promptVersion",
                            "window",
                            "keepMinor",
                            "notBefore",
                            "leaveOut",
                            "includeDeclined",
                            "adjusted",
                            "quote"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "MODEL_FAILED",
                            "NOT_A_PLAN",
                            "NOT_FROM_SENTENCE",
                            "FIGURE_NOT_IN_SENTENCE",
                            "TWO_WINDOWS",
                            "READING_BUSY"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "drafted",
                    "why"
                  ],
                  "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/payment-plans/{planId}": {
      "get": {
        "operationId": "getPaymentPlan",
        "summary": "Returns one payment plan with its status.",
        "description": "Returns one payment plan with its status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "planId",
            "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/CreatePaymentPlanResponse"
                }
              }
            }
          },
          "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/payment-plans/{planId}/decide": {
      "post": {
        "operationId": "decidePaymentPlan",
        "summary": "Accepts or declines a proposed payment plan.",
        "description": "Accepts or declines a proposed payment plan. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "planId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lines": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "lineId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "decision": {
                          "type": "string",
                          "enum": [
                            "APPLY",
                            "DECLINE"
                          ]
                        },
                        "on": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "declineClass": {
                          "type": "string",
                          "enum": [
                            "NOT_NOW",
                            "DISPUTED",
                            "PAID_OTHER_WAY",
                            "OTHER"
                          ]
                        },
                        "note": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        }
                      },
                      "required": [
                        "lineId",
                        "decision"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "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"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatePaymentPlanResponse"
                }
              }
            }
          },
          "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/payment-return-files": {
      "get": {
        "operationId": "listPaymentReturnFiles",
        "summary": "Lists the bank return files that were read, newest first.",
        "description": "Lists the bank return files that were read, newest first. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "runId",
            "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": {
                          "id": {
                            "type": "string"
                          },
                          "documentId": {
                            "type": "string"
                          },
                          "fileName": {
                            "type": "string"
                          },
                          "sha256": {
                            "type": "string",
                            "pattern": "^[0-9a-f]{64}$"
                          },
                          "scopeRunId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "fileCreationNumber": {
                            "type": "string"
                          },
                          "fileCreatedOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "returnedOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "recordCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "itemCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "matchedCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "unmatchedCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "openProposalCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "hiddenItemCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "uploadedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "uploadedAt": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "id",
                          "documentId",
                          "fileName",
                          "sha256",
                          "scopeRunId",
                          "currency",
                          "fileCreationNumber",
                          "fileCreatedOn",
                          "returnedOn",
                          "recordCount",
                          "itemCount",
                          "totalMinor",
                          "matchedCount",
                          "unmatchedCount",
                          "openProposalCount",
                          "hiddenItemCount",
                          "uploadedBy",
                          "uploadedAt"
                        ],
                        "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/payment-return-proposals": {
      "get": {
        "operationId": "listPaymentReturnProposals",
        "summary": "Lists the returned payments waiting for a person, or already decided.",
        "description": "Lists the returned payments waiting for a person, or already decided. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "runId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PROPOSED",
                "CONFIRMED",
                "DISMISSED",
                "SUPERSEDED"
              ]
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BANK_FILE",
                "RAIL"
              ]
            }
          },
          {
            "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/ListPaymentReturnProposalsResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "oldestProposedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "oldestProposedAt"
                  ],
                  "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/payment-return-proposals/{returnProposalId}/confirm": {
      "post": {
        "operationId": "confirmPaymentReturn",
        "summary": "Confirms a proposed return, which reverses the payment and puts its bills back to be paid.",
        "description": "Confirms a proposed return, which reverses the payment and puts its bills back to be paid. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "returnProposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "returnedOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "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/ListPaymentReturnProposalsResponseItem"
                }
              }
            }
          },
          "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/payment-return-proposals/{returnProposalId}/dismiss": {
      "post": {
        "operationId": "dismissPaymentReturn",
        "summary": "Dismisses a proposed return with a reason, leaving the payment as it stands.",
        "description": "Dismisses a proposed return with a reason, leaving the payment as it stands. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "returnProposalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "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/ListPaymentReturnProposalsResponseItem"
                }
              }
            }
          },
          "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/payment-runs": {
      "get": {
        "operationId": "listPaymentRuns",
        "summary": "Lists the payment runs, newest first, with the server's total.",
        "description": "Lists the payment runs, newest first, with the server's total. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "RELEASED",
                "PARTLY_REVERSED",
                "REVERSED",
                "CANCELLED"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "awaiting",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "myRelease"
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "EFT",
                "CHEQUE",
                "WIRE"
              ]
            }
          },
          {
            "name": "bank",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NOT_LODGED",
                "AWAITING_BANK",
                "ACCEPTED",
                "REJECTED"
              ]
            }
          },
          {
            "name": "cleared",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NOT_CLEARED",
                "CLEARED",
                "WITHDRAWN"
              ]
            }
          },
          {
            "name": "preparedBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PERSON",
                "POLICY"
              ]
            }
          },
          {
            "name": "rail",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "FILE",
                "ZUMRAILS"
              ]
            }
          },
          {
            "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"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "RELEASED",
                              "CANCELLED"
                            ]
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "bankAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "paymentDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "paymentCount": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "preparedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "preparedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "releasedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "releasedAt": {
                            "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"
                              }
                            ]
                          },
                          "cancelledAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "cancelReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reversalState": {
                            "type": "string",
                            "enum": [
                              "NONE",
                              "PARTLY_REVERSED",
                              "REVERSED"
                            ]
                          },
                          "method": {
                            "type": "string",
                            "enum": [
                              "EFT",
                              "CHEQUE",
                              "WIRE"
                            ]
                          },
                          "bankState": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "NOT_LODGED",
                                  "AWAITING_BANK",
                                  "ACCEPTED",
                                  "REJECTED"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "bankAccount",
                          "paymentDate",
                          "currency",
                          "totalMinor",
                          "paymentCount",
                          "preparedBy",
                          "preparedAt",
                          "releasedBy",
                          "releasedAt",
                          "cancelledBy",
                          "cancelledAt",
                          "cancelReason",
                          "reversalState",
                          "method",
                          "bankState"
                        ],
                        "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": "preparePaymentRun",
        "summary": "Prepares a payment run from the bills that are due.",
        "description": "Prepares a payment run from the bills that are due. Needs the `ledger:propose` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "financialAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "paymentDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "method": {
                    "default": "EFT",
                    "type": "string",
                    "enum": [
                      "EFT",
                      "CHEQUE",
                      "WIRE"
                    ]
                  },
                  "bills": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "billId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "payMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "shortReason": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "shortReasonSource": {
                          "type": "string",
                          "enum": [
                            "PERSON",
                            "DRAFT",
                            "DRAFT_EDITED"
                          ]
                        },
                        "shortReasonPromptVersion": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "declineDiscountReason": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "credits": {
                          "maxItems": 20,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "vendorCreditId": {
                                "type": "string",
                                "minLength": 1
                              },
                              "amountMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              }
                            },
                            "required": [
                              "vendorCreditId",
                              "amountMinor"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "billId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "billIds": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": [
                  "entityId",
                  "financialAccountId",
                  "paymentDate"
                ],
                "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/PreparePaymentRunResponse"
                }
              }
            }
          },
          "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/payment-runs/bulk/cancel": {
      "post": {
        "operationId": "bulkCancelPaymentRuns",
        "summary": "Cancels several payment runs in one request.",
        "description": "Cancels several payment runs in one request. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkHoldVendorPaymentsRequest"
              }
            }
          }
        },
        "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/BulkHoldVendorPaymentsResponse"
                }
              }
            }
          },
          "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/payment-runs/{runId}": {
      "get": {
        "operationId": "getPaymentRun",
        "summary": "Returns one payment run with its payments and status.",
        "description": "Returns one payment run with its payments and status. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "runId",
            "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
            }
          },
          {
            "name": "coordinates",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "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": {
                  "$ref": "#/components/schemas/PreparePaymentRunResponse"
                }
              }
            }
          },
          "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/payment-runs/{runId}/bank-notices/read": {
      "post": {
        "operationId": "readBankNotice",
        "summary": "Reads the bank notice that came back for a payment run.",
        "description": "Reads the bank notice that came back for a payment run. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 6000
                  }
                },
                "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": {
                    "reading": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "FILE_ACCEPTED",
                                "FILE_REJECTED",
                                "PAYMENTS_RETURNED",
                                "NOT_A_BANK_NOTICE"
                              ]
                            },
                            "noticeDate": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "bankReference": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "fileReasonQuote": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "fileNumberPrinted": {
                              "type": "boolean"
                            },
                            "returns": {
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "returnCode": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "enum": [
                                          "R900",
                                          "R902",
                                          "R903",
                                          "R904",
                                          "R905",
                                          "R909",
                                          "R910",
                                          "R911",
                                          "R912",
                                          "R922",
                                          "R990",
                                          "OTHER"
                                        ]
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "codeSource": {
                                    "type": "string",
                                    "enum": [
                                      "PRINTED",
                                      "WORDS",
                                      "DISAGREES"
                                    ]
                                  },
                                  "quote": {
                                    "type": "string"
                                  },
                                  "match": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "paymentId": {
                                            "type": "string"
                                          },
                                          "sequence": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 9007199254740991
                                          },
                                          "vendorName": {
                                            "type": "string"
                                          },
                                          "amountMinor": {
                                            "type": "string",
                                            "pattern": "^-?\\d+$"
                                          },
                                          "currency": {
                                            "type": "string",
                                            "pattern": "^[A-Z]{3}$"
                                          },
                                          "amountAgrees": {
                                            "type": [
                                              "boolean",
                                              "null"
                                            ]
                                          },
                                          "matchedOn": {
                                            "type": "string",
                                            "enum": [
                                              "CROSS_REFERENCE",
                                              "PAYEE_NAME",
                                              "VENDOR_NAME"
                                            ]
                                          },
                                          "alreadyReversed": {
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "paymentId",
                                          "sequence",
                                          "vendorName",
                                          "amountMinor",
                                          "currency",
                                          "amountAgrees",
                                          "matchedOn",
                                          "alreadyReversed"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "candidates": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "returnCode",
                                  "codeSource",
                                  "quote",
                                  "match",
                                  "candidates"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "quote": {
                              "type": "string"
                            },
                            "note": {
                              "type": "string"
                            },
                            "documentChars": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "sentChars": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "kind",
                            "noticeDate",
                            "bankReference",
                            "fileReasonQuote",
                            "fileNumberPrinted",
                            "returns",
                            "quote",
                            "note",
                            "documentChars",
                            "sentChars",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "type": "string",
                      "enum": [
                        "NOT_RELEASED",
                        "NO_TEXT",
                        "RETURN_FILE",
                        "UNREADABLE",
                        "DISCLOSURE",
                        "BUDGET",
                        "PROVIDER",
                        "REFUSED",
                        "UNPARSABLE",
                        "QUOTE_NOT_IN_TEXT"
                      ]
                    }
                  },
                  "required": [
                    "reading"
                  ],
                  "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/payment-runs/{runId}/brief": {
      "get": {
        "operationId": "getPaymentRunBrief",
        "summary": "Returns the brief a person reads before releasing a payment run.",
        "description": "Returns the brief a person reads before releasing a payment run. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "runId",
            "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": {
                    "runId": {
                      "type": "string"
                    },
                    "readAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "method": {
                      "type": "string",
                      "enum": [
                        "EFT",
                        "CHEQUE",
                        "WIRE"
                      ]
                    },
                    "paymentDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "paymentCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "totalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "functionalTotalMinor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "functionalCurrency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "account": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "displayName": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "displayName"
                          ],
                          "additionalProperties": false
                        },
                        "bookBalanceMinor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "balanceOn": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "shortByMinor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "totalMinor",
                        "currency",
                        "functionalTotalMinor",
                        "functionalCurrency",
                        "account",
                        "bookBalanceMinor",
                        "balanceOn",
                        "shortByMinor"
                      ],
                      "additionalProperties": false
                    },
                    "newPayees": {
                      "$ref": "#/components/schemas/NewPayees"
                    },
                    "aboveHistoricalMax": {
                      "$ref": "#/components/schemas/NewPayees"
                    },
                    "recentBanking": {
                      "maxItems": 500,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "paymentId": {
                            "type": "string"
                          },
                          "sequence": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "verifiedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "verifiedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "daysBeforePayment": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "windowDays": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "signals": {
                            "$ref": "#/components/schemas/BankingSignals"
                          }
                        },
                        "required": [
                          "paymentId",
                          "sequence",
                          "vendor",
                          "verifiedAt",
                          "verifiedBy",
                          "daysBeforePayment",
                          "windowDays",
                          "signals"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "billFindings": {
                      "maxItems": 500,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "paymentId": {
                            "type": "string"
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "billId": {
                            "type": "string"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "supplierName": {
                            "type": "string"
                          },
                          "warnings": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "code": {
                                  "type": "string"
                                },
                                "severity": {
                                  "type": "string",
                                  "enum": [
                                    "WARNING",
                                    "BLOCKING"
                                  ]
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "code",
                                "severity",
                                "message"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "creditSupport": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "FAILS",
                                  "UNTESTED"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "openSignals": {
                            "$ref": "#/components/schemas/BankingSignals"
                          }
                        },
                        "required": [
                          "paymentId",
                          "vendor",
                          "billId",
                          "number",
                          "supplierName",
                          "warnings",
                          "creditSupport",
                          "openSignals"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "vendorStates": {
                      "maxItems": 500,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "paymentId": {
                            "type": "string"
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "HELD",
                              "PENDING_ACCEPTANCE",
                              "REFUSED",
                              "NOT_REVIEWED"
                            ]
                          },
                          "blocksRelease": {
                            "type": "boolean"
                          },
                          "since": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "by": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "paymentId",
                          "vendor",
                          "state",
                          "blocksRelease",
                          "since",
                          "by",
                          "reason"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "deductions": {
                      "maxItems": 500,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "paymentId": {
                            "type": "string"
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "billId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "owedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "paidMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "appliedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "shortReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "deductions": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "CREDIT",
                                    "DISCOUNT",
                                    "WITHHOLDING"
                                  ]
                                },
                                "amountMinor": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                "reason": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "amountMinor",
                                "reason"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "paymentId",
                          "vendor",
                          "billId",
                          "number",
                          "owedMinor",
                          "paidMinor",
                          "appliedMinor",
                          "shortReason",
                          "deductions"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "bankPrints": {
                      "maxItems": 500,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "paymentId": {
                            "type": "string"
                          },
                          "sequence": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "EFT",
                              "CHEQUE",
                              "WIRE"
                            ]
                          },
                          "crossReference": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sundry": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "payeeName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "fileSequence": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "paymentId",
                          "sequence",
                          "vendor",
                          "kind",
                          "crossReference",
                          "sundry",
                          "payeeName",
                          "fileSequence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "sinceLastRelease": {
                      "type": "object",
                      "properties": {
                        "last": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "runId": {
                                  "type": "string"
                                },
                                "paymentDate": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "releasedAt": {
                                  "type": "string",
                                  "minLength": 20
                                },
                                "totalMinor": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                "currency": {
                                  "type": "string",
                                  "pattern": "^[A-Z]{3}$"
                                },
                                "paymentCount": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "runId",
                                "paymentDate",
                                "releasedAt",
                                "totalMinor",
                                "currency",
                                "paymentCount"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "changes": {
                          "maxItems": 500,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "BANKING_VERIFIED"
                                  },
                                  "vendor": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "displayName": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "displayName"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "at": {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  "by": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "kind",
                                  "vendor",
                                  "at",
                                  "by"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "SIGNAL_RAISED"
                                  },
                                  "subject": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "vendor",
                                          "bill"
                                        ]
                                      },
                                      "id": {
                                        "type": "string"
                                      },
                                      "label": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "id",
                                      "label"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "signal": {
                                    "$ref": "#/components/schemas/StoredOption1"
                                  },
                                  "at": {
                                    "type": "string",
                                    "minLength": 20
                                  }
                                },
                                "required": [
                                  "kind",
                                  "subject",
                                  "signal",
                                  "at"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "AUTHORITY_CHANGED"
                                  },
                                  "at": {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  "by": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "capMinor": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^-?\\d+$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "at",
                                  "by",
                                  "capMinor",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "ORIGINATOR_CHANGED"
                                  },
                                  "at": {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  "by": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "account": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "displayName": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "displayName"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "kind",
                                  "at",
                                  "by",
                                  "account"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        }
                      },
                      "required": [
                        "last",
                        "changes"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "runId",
                    "readAt",
                    "entityId",
                    "entityName",
                    "entityTimeZone",
                    "method",
                    "paymentDate",
                    "paymentCount",
                    "totals",
                    "newPayees",
                    "aboveHistoricalMax",
                    "recentBanking",
                    "billFindings",
                    "vendorStates",
                    "deductions",
                    "bankPrints",
                    "sinceLastRelease"
                  ],
                  "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/payment-runs/{runId}/cancel": {
      "post": {
        "operationId": "cancelPaymentRun",
        "summary": "Cancels a payment run that has not been released.",
        "description": "Cancels a payment run that has not been released. Needs the `ledger:propose` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "runId",
            "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/PreparePaymentRunResponse"
                }
              }
            }
          },
          "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/payment-runs/{runId}/notices": {
      "get": {
        "operationId": "listRunRemittance",
        "summary": "Lists the remittance advices of a payment run.",
        "description": "Lists the remittance advices of a payment run. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "runId",
            "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
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/State"
            }
          }
        ],
        "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": {
                          "paymentId": {
                            "type": "string"
                          },
                          "sequence": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "entryStatus": {
                            "type": "string"
                          },
                          "state": {
                            "$ref": "#/components/schemas/State"
                          },
                          "recipient": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "email": {
                                    "type": "string"
                                  },
                                  "contactName": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "email",
                                  "contactName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "advice": {
                            "$ref": "#/components/schemas/Advice"
                          },
                          "reversal": {
                            "$ref": "#/components/schemas/Advice"
                          },
                          "hasDeductions": {
                            "type": "boolean"
                          },
                          "addressSetBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "needsSecondPerson": {
                            "type": "boolean"
                          },
                          "requested": {
                            "$ref": "#/components/schemas/StoppedBy"
                          },
                          "lastDiscard": {
                            "$ref": "#/components/schemas/Retired"
                          },
                          "sentence": {
                            "type": "string"
                          },
                          "paragraphEvidence": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "lines": {
                                    "$ref": "#/components/schemas/Lines"
                                  },
                                  "standardParagraph": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "lines",
                                  "standardParagraph"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "paymentId",
                          "sequence",
                          "vendor",
                          "amountMinor",
                          "currency",
                          "entryStatus",
                          "state",
                          "recipient",
                          "advice",
                          "reversal",
                          "hasDeductions",
                          "addressSetBy",
                          "needsSecondPerson",
                          "requested",
                          "lastDiscard",
                          "sentence",
                          "paragraphEvidence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "propertyNames": {
                        "$ref": "#/components/schemas/State"
                      },
                      "additionalProperties": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "required": [
                        "NO_CONTACT_ON_RECORD",
                        "NOT_DRAFTED",
                        "TO_SEND",
                        "NEEDS_SECOND_PERSON",
                        "NOT_SENDABLE",
                        "ON_ITS_WAY",
                        "NOT_SENT_GAVE_UP",
                        "SENT",
                        "BOUNCED",
                        "DISCARDED",
                        "REVERSAL_TO_SEND",
                        "REVERSAL_SENT"
                      ]
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "counts",
                    "entityTimeZone"
                  ],
                  "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": "draftRemittanceAdvices",
        "summary": "Drafts the remittance advices for a payment run.",
        "description": "Drafts the remittance advices for a payment run. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paymentIds": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "replaceNoticeId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "replaceReason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "paragraph": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 600
                      },
                      "source": {
                        "type": "string",
                        "enum": [
                          "STANDARD",
                          "PERSON",
                          "AGENT_DRAFT",
                          "AGENT_DRAFT_EDITED"
                        ]
                      },
                      "promptVersion": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      }
                    },
                    "required": [
                      "text",
                      "source"
                    ],
                    "additionalProperties": false
                  }
                },
                "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": {
                    "drafted": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "skipped": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "paymentId": {
                            "type": "string"
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "why": {
                            "type": "string",
                            "enum": [
                              "NO_CONTACT_ON_RECORD",
                              "ALREADY_LIVE",
                              "PAYMENT_REVERSED"
                            ]
                          }
                        },
                        "required": [
                          "paymentId",
                          "vendor",
                          "why"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "drafted",
                    "skipped"
                  ],
                  "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/payment-runs/{runId}/notices/send": {
      "post": {
        "operationId": "sendRemittanceAdvices",
        "summary": "Sends the remittance advices of a payment run to the vendors.",
        "description": "Sends the remittance advices of a payment run to the vendors. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "noticeIds": {
                    "minItems": 1,
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "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": {
                    "requested": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "alreadySent": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "held": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "noticeId": {
                            "type": "string"
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "why": {
                            "type": "string",
                            "enum": [
                              "NEEDS_SECOND_PERSON",
                              "NO_NAMED_CONTACT",
                              "RECIPIENT_CHANGED",
                              "RECIPIENT_STOPPED",
                              "RECIPIENT_BOUNCED",
                              "ALREADY_ASKED",
                              "NOT_DRAFTED"
                            ]
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "noticeId",
                          "vendor",
                          "why",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "requested",
                    "alreadySent",
                    "held"
                  ],
                  "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/payment-runs/{runId}/notices/{noticeId}/paragraph": {
      "post": {
        "operationId": "draftRemittanceParagraph",
        "summary": "Drafts the paragraph a remittance advice carries for one payment.",
        "description": "Drafts the paragraph a remittance advice carries for one payment. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "noticeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "default": "",
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "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": {
                    "drafted": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "why": {
                      "type": "string",
                      "enum": [
                        "DISCLOSURE",
                        "BUDGET",
                        "PROVIDER",
                        "UNPARSABLE",
                        "REFUSED",
                        "FIGURE_INVENTED",
                        "CONTACT_DETAIL",
                        "BANKING_WORDS",
                        "PROMISE",
                        "PAUSED_AFTER_THREE_UNUSED"
                      ]
                    },
                    "promptVersion": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resumesOn": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    }
                  },
                  "required": [
                    "drafted",
                    "promptVersion"
                  ],
                  "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/payment-runs/{runId}/payments/{paymentId}/remove": {
      "post": {
        "operationId": "removeRunPayment",
        "summary": "Removes one payment from a payment run before it is released.",
        "description": "Removes one payment from a payment run before it is released. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "paymentId",
            "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
                  },
                  "decline": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "TOO_MUCH",
                          "TOO_EARLY",
                          "WRONG_SUPPLIER",
                          "OTHER"
                        ]
                      },
                      "suggestion": {
                        "$ref": "#/components/schemas/Suggestion"
                      }
                    },
                    "required": [
                      "kind"
                    ],
                    "additionalProperties": false
                  }
                },
                "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/PreparePaymentRunResponse"
                }
              }
            }
          },
          "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/payment-runs/{runId}/payments/{paymentId}/reverse": {
      "post": {
        "operationId": "reversePayment",
        "summary": "Reverses one payment in a released payment run.",
        "description": "Reverses one payment in a released payment run. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "returnCode": {
                    "type": "string",
                    "enum": [
                      "R900",
                      "R902",
                      "R903",
                      "R904",
                      "R905",
                      "R909",
                      "R910",
                      "R911",
                      "R912",
                      "R922",
                      "R990",
                      "OTHER"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "returnedOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "evidenceDocumentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "reading": {
                    "default": "NOT_READ",
                    "type": "string",
                    "enum": [
                      "NOT_READ",
                      "AGREES",
                      "DIFFERS"
                    ]
                  },
                  "readingPromptVersion": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  }
                },
                "required": [
                  "returnCode",
                  "returnedOn"
                ],
                "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/PreparePaymentRunResponse"
                }
              }
            }
          },
          "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/payment-runs/{runId}/rail": {
      "get": {
        "operationId": "getPaymentRunRail",
        "summary": "Reads the Zūm Rails payouts of a payment run, one page at a time.",
        "description": "Reads the Zūm Rails payouts of a payment run, one page at a time. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "runId",
            "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"
                          },
                          "paymentId": {
                            "type": "string"
                          },
                          "sequence": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "const": "CAD"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "QUEUED",
                              "SUBMITTED",
                              "SETTLED",
                              "FAILED",
                              "RETURNED"
                            ]
                          },
                          "providerStatus": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reasonCode": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reasonWords": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 300
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "mappedReturnCode": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "R900",
                                  "R902",
                                  "R903",
                                  "R904",
                                  "R905",
                                  "R909",
                                  "R910",
                                  "R911",
                                  "R912",
                                  "R922",
                                  "R990",
                                  "OTHER"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "feeMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "submittedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "settledAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "failedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "returnedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lastEventAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "attempts": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 12
                          }
                        },
                        "required": [
                          "id",
                          "paymentId",
                          "sequence",
                          "vendor",
                          "amountMinor",
                          "currency",
                          "status",
                          "providerStatus",
                          "reasonCode",
                          "reasonWords",
                          "mappedReturnCode",
                          "feeMinor",
                          "submittedAt",
                          "settledAt",
                          "failedAt",
                          "returnedAt",
                          "lastEventAt",
                          "attempts"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "dispatch": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "dispatchedBy": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        "dispatchedAt": {
                          "type": "string",
                          "minLength": 20
                        },
                        "environment": {
                          "type": "string",
                          "enum": [
                            "SANDBOX",
                            "PRODUCTION"
                          ]
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "FAILED",
                            "PARTLY_FAILED",
                            "SENDING",
                            "IN_PROGRESS",
                            "SETTLED"
                          ]
                        },
                        "counts": {
                          "type": "object",
                          "properties": {
                            "queued": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "submitted": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "settled": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "failed": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "returned": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "queued",
                            "submitted",
                            "settled",
                            "failed",
                            "returned"
                          ],
                          "additionalProperties": false
                        },
                        "totalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "paymentCount": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 9007199254740991
                        },
                        "connection": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "displayName": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "displayName"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "id",
                        "dispatchedBy",
                        "dispatchedAt",
                        "environment",
                        "state",
                        "counts",
                        "totalMinor",
                        "paymentCount",
                        "connection"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "dispatch"
                  ],
                  "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/payment-runs/{runId}/rail-stop": {
      "post": {
        "operationId": "stopRailPayouts",
        "summary": "Stops the payments of a run that Zūm Rails has not yet been sent, so they can be paid another way.",
        "description": "Stops the payments of a run that Zūm Rails has not yet been sent, so they can be paid another way. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "runId",
            "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": 300
                  }
                },
                "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/PreparePaymentRunResponse"
                }
              }
            }
          },
          "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/payment-runs/{runId}/register": {
      "get": {
        "operationId": "getChequeRegister",
        "summary": "Returns the cheque register of a payment run.",
        "description": "Returns the cheque register of a payment run. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "runId",
            "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": {
                    "runId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "account": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "displayName"
                      ],
                      "additionalProperties": false
                    },
                    "registerNumber": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9999
                    },
                    "paymentDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "totalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "releasedBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "releasedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "cheques": {
                      "maxItems": 500,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "number": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "ISSUED",
                              "VOIDED"
                            ]
                          },
                          "payeeName": {
                            "type": "string"
                          },
                          "mailingAddress": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "bills": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "billId": {
                                  "type": "string"
                                },
                                "number": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "amountMinor": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                }
                              },
                              "required": [
                                "billId",
                                "number",
                                "amountMinor"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "number",
                          "state",
                          "payeeName",
                          "mailingAddress",
                          "amountMinor",
                          "bills"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "runId",
                    "entityName",
                    "entityTimeZone",
                    "account",
                    "registerNumber",
                    "paymentDate",
                    "currency",
                    "totalMinor",
                    "releasedBy",
                    "releasedAt",
                    "cheques"
                  ],
                  "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/payment-runs/{runId}/reverse": {
      "post": {
        "operationId": "reversePaymentRun",
        "summary": "Reverses a released payment run.",
        "description": "Reverses a released payment run. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "runId",
            "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/PreparePaymentRunResponse"
                }
              }
            }
          },
          "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/payment-terms": {
      "get": {
        "operationId": "listPaymentTerms",
        "summary": "Lists the payment terms the ledger offers.",
        "description": "Lists the payment terms the ledger offers. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "side",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "SALES",
                "PURCHASES"
              ]
            }
          },
          {
            "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/ListPaymentTermsResponseItem"
                      }
                    },
                    "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": "createPaymentTerms",
        "summary": "Creates a set of payment terms.",
        "description": "Creates a set of payment terms. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "netDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 365
                  },
                  "discountBp": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "discountDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 365
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "discountAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "interestMonthlyBp": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "interestAnnualBp": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 100000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "appliesTo": {
                    "default": "SALES",
                    "type": "string",
                    "enum": [
                      "SALES",
                      "PURCHASES",
                      "BOTH"
                    ]
                  }
                },
                "required": [
                  "name",
                  "netDays"
                ],
                "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/ListPaymentTermsResponseItem"
                }
              }
            }
          },
          "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/payment-terms/draft": {
      "post": {
        "operationId": "draftVendorTerms",
        "summary": "Drafts the payment terms to propose for a vendor.",
        "description": "Drafts the payment terms to propose for a vendor. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "words": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "side": {
                    "default": "PURCHASES",
                    "type": "string",
                    "enum": [
                      "SALES",
                      "PURCHASES"
                    ]
                  }
                },
                "required": [
                  "words"
                ],
                "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": {
                    "drafted": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "matchTermsId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "matchName": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "proposed": {
                              "type": "object",
                              "properties": {
                                "netDays": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 365
                                },
                                "discountBp": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "discountDays": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 365
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "interestMonthlyBp": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 10000
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "interestAnnualBp": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 100000
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "netDays",
                                "discountBp",
                                "discountDays",
                                "interestMonthlyBp",
                                "interestAnnualBp"
                              ],
                              "additionalProperties": false
                            },
                            "quote": {
                              "type": "string",
                              "maxLength": 500
                            }
                          },
                          "required": [
                            "matchTermsId",
                            "matchName",
                            "proposed",
                            "quote"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "type": "string",
                      "enum": [
                        "DISCLOSURE",
                        "BUDGET",
                        "PROVIDER",
                        "UNPARSABLE",
                        "REFUSED",
                        "FIGURE_INVENTED",
                        "STOPPED_AFTER_THREE_REWRITES"
                      ]
                    }
                  },
                  "required": [
                    "drafted"
                  ],
                  "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/payment-terms/{termsId}": {
      "patch": {
        "operationId": "updatePaymentTerms",
        "summary": "Changes a set of payment terms.",
        "description": "Changes a set of payment terms. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "termsId",
            "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
                  },
                  "netDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 365
                  },
                  "discountBp": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "discountDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 365
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "discountAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "interestMonthlyBp": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "interestAnnualBp": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 100000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "appliesTo": {
                    "type": "string",
                    "enum": [
                      "SALES",
                      "PURCHASES",
                      "BOTH"
                    ]
                  }
                },
                "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/ListPaymentTermsResponseItem"
                }
              }
            }
          },
          "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/payment-terms/{termsId}/default": {
      "post": {
        "operationId": "setDefaultPaymentTerms",
        "summary": "Makes one set of payment terms the default.",
        "description": "Makes one set of payment terms the default. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "termsId",
            "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/ListPaymentTermsResponseItem"
                }
              }
            }
          },
          "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/people": {
      "get": {
        "operationId": "listLedgerPeople",
        "summary": "Lists the people who hold a seat on the ledger.",
        "description": "Lists the people who hold a seat on the ledger. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "people"
        ],
        "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
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "role",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "coversEntityId",
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "ADMIN",
                              "APPROVER",
                              "PREPARER",
                              "VIEWER"
                            ]
                          },
                          "capabilities": {
                            "anyOf": [
                              {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "coversEntity": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "role"
                        ],
                        "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/periods": {
      "get": {
        "operationId": "listPeriodLocks",
        "summary": "Lists the accounting periods and whether each one is locked.",
        "description": "Lists the accounting periods and whether each one is locked. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "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
            }
          },
          {
            "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": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListPeriodLocksResponseItem"
                      }
                    },
                    "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
                }
              }
            }
          },
          "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/periods/lock": {
      "post": {
        "operationId": "lockPeriod",
        "summary": "Locks an accounting period so that nothing can be posted into it.",
        "description": "Locks an accounting period so that nothing can be posted into it. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "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"
                  },
                  "subledger": {
                    "default": "GL",
                    "type": "string",
                    "enum": [
                      "GL",
                      "AP",
                      "AR",
                      "BANK",
                      "TAX"
                    ]
                  },
                  "periodYear": {
                    "type": "integer",
                    "minimum": 2000,
                    "maximum": 2100
                  },
                  "periodMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "fromImportedHistoryId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "periodYear",
                  "periodMonth",
                  "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/ListPeriodLocksResponseItem"
                }
              }
            }
          },
          "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/periods/unlock": {
      "post": {
        "operationId": "unlockPeriod",
        "summary": "Unlocks an accounting period so that entries can be posted into it again.",
        "description": "Unlocks an accounting period so that entries can be posted into it again. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lockId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  }
                },
                "required": [
                  "lockId",
                  "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/ListPeriodLocksResponseItem"
                }
              }
            }
          },
          "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/places/autocomplete": {
      "post": {
        "operationId": "placesAutocomplete",
        "summary": "Suggests addresses from a partial address typed into a form.",
        "description": "Suggests addresses from a partial address typed into a form. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "sessionToken": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{1,36}$"
                  },
                  "languageCode": {
                    "type": "string",
                    "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                  },
                  "countries": {
                    "minItems": 1,
                    "maxItems": 15,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Z]{2}$"
                    }
                  }
                },
                "required": [
                  "input",
                  "sessionToken"
                ],
                "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": {
                    "suggestions": {
                      "maxItems": 5,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "placeId": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9_-]{1,512}$"
                          },
                          "mainText": {
                            "type": "string"
                          },
                          "secondaryText": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "placeId",
                          "mainText",
                          "secondaryText"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "suggestions"
                  ],
                  "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/places/details": {
      "post": {
        "operationId": "placeDetails",
        "summary": "Returns the full address of a place a person picked.",
        "description": "Returns the full address of a place a person picked. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "placeId": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{1,512}$"
                  },
                  "sessionToken": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{1,36}$"
                  },
                  "languageCode": {
                    "type": "string",
                    "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
                  }
                },
                "required": [
                  "placeId",
                  "sessionToken"
                ],
                "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": {
                    "placeId": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]{1,512}$"
                    },
                    "formattedAddress": {
                      "type": "string"
                    },
                    "line1": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "line2": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "city": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "region": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^(CA|US)-[A-Z]{2}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "postalCode": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "country": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "placeId",
                    "formattedAddress",
                    "line1",
                    "line2",
                    "city",
                    "region",
                    "postalCode",
                    "country"
                  ],
                  "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/prepaid-schedules/{prepaidScheduleId}/end-early": {
      "post": {
        "operationId": "endPrepaidScheduleEarly",
        "summary": "Ends a prepaid schedule before its last period.",
        "description": "Ends a prepaid schedule before its last period. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "prepaidScheduleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "destinationAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "CANCELLED",
                      "REFUNDED",
                      "WRITTEN_OFF",
                      "OTHER"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 300
                  }
                },
                "required": [
                  "destinationAccountId",
                  "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": {
                    "scheduleId": {
                      "type": "string"
                    },
                    "entryId": {
                      "type": "string"
                    },
                    "proposalId": {
                      "type": "string"
                    },
                    "rowCount": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "amountMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    }
                  },
                  "required": [
                    "scheduleId",
                    "entryId",
                    "proposalId",
                    "rowCount",
                    "amountMinor"
                  ],
                  "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/privacy-requests/contact": {
      "get": {
        "operationId": "getPrivacyRequestContact",
        "summary": "Gives the fixed answer to any request to erase or delete personal data: people handle it at info@eternifylabs.com.",
        "description": "Gives the fixed answer to any request to erase or delete personal data: people handle it at info@eternifylabs.com. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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": {
                    "message": {
                      "type": "string"
                    },
                    "messageFr": {
                      "type": "string"
                    },
                    "address": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message",
                    "messageFr",
                    "address"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "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/promotion-previews": {
      "get": {
        "operationId": "previewPromotion",
        "summary": "Previews what promoting configuration from a test copy would change on these books, and what conflicts.",
        "description": "Previews what promoting configuration from a test copy would change on these books, and what conflicts. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "testCopyId",
            "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": {
                  "type": "object",
                  "properties": {
                    "changes": {
                      "$ref": "#/components/schemas/Changes"
                    },
                    "conflicts": {
                      "$ref": "#/components/schemas/Conflicts"
                    },
                    "realVersion": {
                      "type": "string"
                    },
                    "copyVersion": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "changes",
                    "conflicts",
                    "realVersion",
                    "copyVersion"
                  ],
                  "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/promotions": {
      "post": {
        "operationId": "proposePromotion",
        "summary": "Proposes promoting selected configuration from a test copy to these books, for a second administrator to approve.",
        "description": "Proposes promoting selected configuration from a test copy to these books, for a second administrator to approve. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "testCopyId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "keys": {
                    "minItems": 1,
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "resolutions": {
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "minLength": 1
                        },
                        "field": {
                          "type": "string",
                          "minLength": 1
                        },
                        "take": {
                          "type": "string",
                          "enum": [
                            "copy",
                            "real"
                          ]
                        }
                      },
                      "required": [
                        "key",
                        "field",
                        "take"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "soleAdministrator": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "minLength": 10,
                        "maxLength": 500
                      }
                    },
                    "required": [
                      "reason"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "testCopyId",
                  "keys"
                ],
                "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/GetPromotionResponse"
                }
              }
            }
          },
          "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": "listPromotions",
        "summary": "Lists the promotions from test copies to these books, newest first.",
        "description": "Lists the promotions from test copies to these books, newest first. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PROPOSED",
                "APPLIED",
                "CONFLICTED"
              ]
            }
          },
          {
            "name": "testCopyId",
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/GetPromotionResponse"
                      }
                    },
                    "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/promotions/{promotionId}": {
      "get": {
        "operationId": "getPromotion",
        "summary": "Reads one promotion with its changes, conflicts and state.",
        "description": "Reads one promotion with its changes, conflicts and state. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "promotionId",
            "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/GetPromotionResponse"
                }
              }
            }
          },
          "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/promotions/{promotionId}/apply": {
      "post": {
        "operationId": "applyPromotion",
        "summary": "Applies an approved promotion to these books all at once, or refuses it whole if the books changed; reached only as the approval replay.",
        "description": "Applies an approved promotion to these books all at once, or refuses it whole if the books changed; reached only as the approval replay. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "promotionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "soleAdministrator": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "minLength": 10,
                        "maxLength": 500
                      }
                    },
                    "required": [
                      "reason"
                    ],
                    "additionalProperties": false
                  }
                },
                "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"
          },
          "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/purchase-order-lines": {
      "get": {
        "operationId": "listPurchaseOrderLines",
        "summary": "Lists the purchase order lines, with the server's total.",
        "description": "Lists the purchase order lines, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "billId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "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"
                          },
                          "orderId": {
                            "type": "string"
                          },
                          "orderNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "position": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "description": {
                            "type": "string"
                          },
                          "remainingQuantity": {
                            "type": "string",
                            "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                          },
                          "unitPriceMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "orderStatus": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "IN_APPROVAL",
                              "APPROVED",
                              "SENT",
                              "PART_RECEIVED",
                              "RECEIVED",
                              "CLOSED",
                              "CANCELLED"
                            ]
                          },
                          "fullyBilled": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "orderId",
                          "orderNumber",
                          "position",
                          "description",
                          "remainingQuantity",
                          "unitPriceMinor",
                          "currency",
                          "orderStatus",
                          "fullyBilled"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "total",
                    "nextCursor"
                  ],
                  "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/purchase-orders": {
      "get": {
        "operationId": "listPurchaseOrders",
        "summary": "Lists the purchase orders, with the server's total.",
        "description": "Lists the purchase orders, with the server's total. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "DRAFT",
                    "IN_APPROVAL",
                    "APPROVED",
                    "SENT",
                    "PART_RECEIVED",
                    "RECEIVED",
                    "CLOSED",
                    "CANCELLED"
                  ]
                },
                {
                  "type": "string",
                  "const": "open"
                }
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "requestedById",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "awaiting",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "myApproval",
                "receipt"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "orderFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "orderTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "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"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "IN_APPROVAL",
                              "APPROVED",
                              "SENT",
                              "PART_RECEIVED",
                              "RECEIVED",
                              "CLOSED",
                              "CANCELLED"
                            ]
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "MANUAL",
                              "QUOTE_READ",
                              "PATTERN",
                              "IMPORT"
                            ]
                          },
                          "revision": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "entity": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "vendor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "supplierReference": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "functionalTotalMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "expectedBy": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "orderDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "createdAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "requestedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "submittedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "sentAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "declined": {
                            "$ref": "#/components/schemas/Retired"
                          },
                          "customFields": {
                            "$ref": "#/components/schemas/CustomFields2"
                          }
                        },
                        "required": [
                          "id",
                          "number",
                          "status",
                          "source",
                          "revision",
                          "entity",
                          "entityTimeZone",
                          "vendor",
                          "supplierReference",
                          "currency",
                          "totalMinor",
                          "functionalTotalMinor",
                          "lineCount",
                          "expectedBy",
                          "orderDate",
                          "createdAt",
                          "requestedBy",
                          "submittedAt",
                          "sentAt",
                          "declined"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "total",
                    "nextCursor"
                  ],
                  "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": "createPurchaseOrder",
        "summary": "Creates a draft purchase order for a vendor.",
        "description": "Creates a draft purchase order for a vendor. Needs the `ledger:propose` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "vendorId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "supplierReference": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "deliveryNote": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "memo": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "default": [],
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/LinesItem"
                    }
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields3"
                  }
                },
                "required": [
                  "entityId",
                  "vendorId",
                  "currency"
                ],
                "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/CreatePurchaseOrderResponse"
                }
              }
            }
          },
          "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/purchase-orders/bulk/submit": {
      "post": {
        "operationId": "bulkSubmitPurchaseOrders",
        "summary": "Submits several purchase orders for approval in one request.",
        "description": "Submits several purchase orders for approval in one request. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkHoldVendorPaymentsRequest"
              }
            }
          }
        },
        "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/BulkHoldVendorPaymentsResponse"
                }
              }
            }
          },
          "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/purchase-orders/number-series": {
      "get": {
        "operationId": "getPurchaseOrderNumberSeries",
        "summary": "Returns the numbering series purchase orders are raised under.",
        "description": "Returns the numbering series purchase orders are raised under. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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/GetPurchaseOrderNumberSeriesResponse"
                }
              }
            }
          },
          "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"
          }
        }
      },
      "put": {
        "operationId": "updatePurchaseOrderNumberSeries",
        "summary": "Changes the numbering series purchase orders are raised under.",
        "description": "Changes the numbering series purchase orders are raised under. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
                  },
                  "prefix": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9-]{1,12}$"
                  },
                  "padding": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "next": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "entityId",
                  "prefix",
                  "padding",
                  "next"
                ],
                "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/GetPurchaseOrderNumberSeriesResponse"
                }
              }
            }
          },
          "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/purchase-orders/quote-read": {
      "post": {
        "operationId": "readPurchaseOrderQuote",
        "summary": "Reads a vendor quote against a purchase order draft.",
        "description": "Reads a vendor quote against a purchase order draft. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "documentId",
                  "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"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "read": {
                          "type": "object",
                          "properties": {
                            "supplier": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "candidates": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "displayName": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "displayName"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "name",
                                "candidates"
                              ],
                              "additionalProperties": false
                            },
                            "quoteNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "quoteDate": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "validUntil": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "currency": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^[A-Z]{3}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "printedTotalMinor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "lines": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "description": {
                                    "type": "string"
                                  },
                                  "quantity": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "unitPriceMinor": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^-?\\d+$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "expectedDate": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "evidence": {
                                    "type": "string"
                                  },
                                  "unread": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "required": [
                                  "description",
                                  "quantity",
                                  "unitPriceMinor",
                                  "expectedDate",
                                  "evidence",
                                  "unread"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "warnings": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "pagesRead": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "charsRead": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "charsThere": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "supplier",
                            "quoteNumber",
                            "quoteDate",
                            "validUntil",
                            "currency",
                            "printedTotalMinor",
                            "lines",
                            "warnings",
                            "pagesRead",
                            "charsRead",
                            "charsThere",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        "why": {
                          "type": "null"
                        }
                      },
                      "required": [
                        "read",
                        "why"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "read": {
                          "type": "null"
                        },
                        "why": {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNPARSABLE",
                            "REFUSED",
                            "UNREADABLE",
                            "NOT_A_QUOTE",
                            "PAUSED_AFTER_THREE_EDITED"
                          ]
                        },
                        "resumesOn": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        }
                      },
                      "required": [
                        "read",
                        "why"
                      ],
                      "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/purchase-orders/suggestions": {
      "get": {
        "operationId": "listPurchaseOrderSuggestions",
        "summary": "Lists the purchase orders the ledger suggests raising, waiting for a decision.",
        "description": "Lists the purchase orders the ledger suggests raising, waiting for a decision. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "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": {
                    "data": {
                      "maxItems": 5,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "patternBillId": {
                            "type": "string"
                          },
                          "cadenceDays": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "lastBills": {
                            "maxItems": 3,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "number": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "billDate": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                }
                              },
                              "required": [
                                "number",
                                "billDate"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "lastSubtotalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "dueOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "entityId",
                          "vendor",
                          "patternBillId",
                          "cadenceDays",
                          "lastBills",
                          "lastSubtotalMinor",
                          "currency",
                          "dueOn",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "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/purchase-orders/suggestions/decline": {
      "post": {
        "operationId": "declinePurchaseOrderSuggestion",
        "summary": "Declines a suggested purchase order with a reason.",
        "description": "Declines a suggested purchase order with a reason. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
                  },
                  "vendorId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "patternBillId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "reason": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "entityId",
                  "vendorId",
                  "patternBillId"
                ],
                "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/DeclinePurchaseOrderSuggestionResponse"
                }
              }
            }
          },
          "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/purchase-orders/{purchaseOrderId}": {
      "get": {
        "operationId": "getPurchaseOrder",
        "summary": "Returns one purchase order with its lines and status.",
        "description": "Returns one purchase order with its lines and status. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "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"
                    },
                    "number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "DRAFT",
                        "IN_APPROVAL",
                        "APPROVED",
                        "SENT",
                        "PART_RECEIVED",
                        "RECEIVED",
                        "CLOSED",
                        "CANCELLED"
                      ]
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "MANUAL",
                        "QUOTE_READ",
                        "PATTERN",
                        "IMPORT"
                      ]
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "entity": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "vendor": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "displayName": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "displayName"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "supplierReference": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "totalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "functionalTotalMinor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "lineCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "expectedBy": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "orderDate": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "createdAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "requestedBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "submittedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "sentAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "declined": {
                      "$ref": "#/components/schemas/Retired"
                    },
                    "customFields": {
                      "$ref": "#/components/schemas/CustomFields2"
                    },
                    "deliveryNote": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "memo": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "lines": {
                      "$ref": "#/components/schemas/Lines6"
                    },
                    "gaps": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "quote": {
                      "$ref": "#/components/schemas/Quote"
                    },
                    "pattern": {
                      "$ref": "#/components/schemas/Pattern"
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "audit": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "audit"
                      ],
                      "additionalProperties": false
                    },
                    "closed": {
                      "$ref": "#/components/schemas/Closed"
                    }
                  },
                  "required": [
                    "id",
                    "number",
                    "status",
                    "source",
                    "revision",
                    "entity",
                    "entityTimeZone",
                    "vendor",
                    "supplierReference",
                    "currency",
                    "totalMinor",
                    "functionalTotalMinor",
                    "lineCount",
                    "expectedBy",
                    "orderDate",
                    "createdAt",
                    "requestedBy",
                    "submittedAt",
                    "sentAt",
                    "declined",
                    "deliveryNote",
                    "memo",
                    "lines",
                    "gaps",
                    "quote",
                    "pattern",
                    "counts",
                    "closed"
                  ],
                  "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"
          }
        }
      },
      "patch": {
        "operationId": "updatePurchaseOrder",
        "summary": "Changes a draft purchase order.",
        "description": "Changes a draft purchase order. Needs the `ledger:propose` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "vendorId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "supplierReference": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "deliveryNote": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "memo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/LinesItem"
                    }
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields4"
                  }
                },
                "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/CreatePurchaseOrderResponse"
                }
              }
            }
          },
          "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/purchase-orders/{purchaseOrderId}/approve": {
      "post": {
        "operationId": "approvePurchaseOrder",
        "summary": "Approves a purchase order so it can be sent to the vendor.",
        "description": "Approves a purchase order so it can be sent to the vendor. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "seenTotalMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  }
                },
                "required": [
                  "seenTotalMinor"
                ],
                "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/CreatePurchaseOrderResponse"
                }
              }
            }
          },
          "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/purchase-orders/{purchaseOrderId}/approvers": {
      "get": {
        "operationId": "listPurchaseOrderApprovers",
        "summary": "Lists the people who may approve one purchase order.",
        "description": "Lists the people who may approve one purchase order. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "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
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          }
        ],
        "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"
                          },
                          "name": {
                            "type": "string"
                          },
                          "capText": {
                            "type": "string"
                          },
                          "ownWorkText": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "unavailable": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "capText",
                          "ownWorkText",
                          "unavailable"
                        ],
                        "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/purchase-orders/{purchaseOrderId}/audit": {
      "get": {
        "operationId": "listPurchaseOrderAudit",
        "summary": "Lists the audit trail of one purchase order.",
        "description": "Lists the audit trail of one purchase order. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "prefix",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][A-Za-z]*\\.$"
            }
          },
          {
            "name": "actions",
            "in": "query",
            "required": false,
            "description": "Exact audit action names, separated by commas, at most 20.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 600,
              "description": "Exact audit action names, separated by commas, at most 20."
            }
          },
          {
            "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/purchase-orders/{purchaseOrderId}/billing": {
      "get": {
        "operationId": "getPurchaseOrderBilling",
        "summary": "Returns the billing position of a purchase order.",
        "description": "Returns the billing position of a purchase order. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "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": {
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "position": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "description": {
                            "type": "string"
                          },
                          "orderedQuantity": {
                            "type": "string",
                            "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                          },
                          "receivedQuantity": {
                            "type": "string",
                            "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                          },
                          "billedQuantity": {
                            "type": "string",
                            "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                          },
                          "billedNetMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "unitPriceMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "fullyBilled": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "position",
                          "description",
                          "orderedQuantity",
                          "receivedQuantity",
                          "billedQuantity",
                          "billedNetMinor",
                          "unitPriceMinor",
                          "fullyBilled"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "foot": {
                      "type": "object",
                      "properties": {
                        "orderedMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "billedNetMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        }
                      },
                      "required": [
                        "orderedMinor",
                        "billedNetMinor",
                        "currency"
                      ],
                      "additionalProperties": false
                    },
                    "bills": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "billId": {
                                "type": "string"
                              },
                              "supplierName": {
                                "type": "string"
                              },
                              "number": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "status": {
                                "type": "string"
                              },
                              "billDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "netOnThisOrderMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "findings": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "billId",
                              "supplierName",
                              "number",
                              "status",
                              "billDate",
                              "netOnThisOrderMinor",
                              "currency",
                              "findings"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "items",
                        "nextCursor",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "lines",
                    "foot",
                    "bills",
                    "entityTimeZone"
                  ],
                  "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/purchase-orders/{purchaseOrderId}/budget-position": {
      "get": {
        "operationId": "getPurchaseOrderBudgetPosition",
        "summary": "Returns the budget position a purchase order would draw on.",
        "description": "Returns the budget position a purchase order would draw on. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "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/GetPurchaseOrderBudgetPositionResponse"
                }
              }
            }
          },
          "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/purchase-orders/{purchaseOrderId}/cancel": {
      "post": {
        "operationId": "cancelPurchaseOrder",
        "summary": "Cancels a purchase order that has not been fully received.",
        "description": "Cancels a purchase order that has not been fully received. Needs the `ledger:propose` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "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/CreatePurchaseOrderResponse"
                }
              }
            }
          },
          "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/purchase-orders/{purchaseOrderId}/close": {
      "post": {
        "operationId": "closePurchaseOrder",
        "summary": "Closes a purchase order so no more can be received or billed against it.",
        "description": "Closes a purchase order so no more can be received or billed against it. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "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/ClosePurchaseOrderResponse"
                }
              }
            }
          },
          "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/purchase-orders/{purchaseOrderId}/close/lift": {
      "post": {
        "operationId": "liftPurchaseOrderClose",
        "summary": "Lifts the close on a purchase order so it can be received against again.",
        "description": "Lifts the close on a purchase order so it can be received against again. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "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/ClosePurchaseOrderResponse"
                }
              }
            }
          },
          "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/purchase-orders/{purchaseOrderId}/decline": {
      "post": {
        "operationId": "declinePurchaseOrder",
        "summary": "Declines a submitted purchase order with a reason.",
        "description": "Declines a submitted purchase order with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "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/CreatePurchaseOrderResponse"
                }
              }
            }
          },
          "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/purchase-orders/{purchaseOrderId}/notices": {
      "post": {
        "operationId": "draftPurchaseOrderNotice",
        "summary": "Drafts a notice to the vendor about a purchase order.",
        "description": "Drafts a notice to the vendor about a purchase order. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "PURCHASE_ORDER",
                      "PURCHASE_ORDER_CANCELLED"
                    ]
                  },
                  "recipientEmail": {
                    "type": "string",
                    "maxLength": 254,
                    "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,}$"
                  },
                  "paragraph": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 600
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "kind",
                  "recipientEmail"
                ],
                "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/CreatePurchaseOrderResponse"
                }
              }
            }
          },
          "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/purchase-orders/{purchaseOrderId}/receiving": {
      "get": {
        "operationId": "getPurchaseOrderReceiving",
        "summary": "Returns how much of a purchase order has been received.",
        "description": "Returns how much of a purchase order has been received. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "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": {
                    "purchaseOrderId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "DRAFT",
                        "IN_APPROVAL",
                        "APPROVED",
                        "SENT",
                        "PART_RECEIVED",
                        "RECEIVED",
                        "CLOSED",
                        "CANCELLED"
                      ]
                    },
                    "receivable": {
                      "type": "boolean"
                    },
                    "notReceivableWhy": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "tolerance": {
                      "type": "object",
                      "properties": {
                        "percent": {
                          "type": "string"
                        },
                        "sentence": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "percent",
                        "sentence"
                      ],
                      "additionalProperties": false
                    },
                    "separation": {
                      "type": "object",
                      "properties": {
                        "applies": {
                          "type": "boolean"
                        },
                        "approver": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "sentence": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "applies",
                        "approver",
                        "sentence"
                      ],
                      "additionalProperties": false
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "purchaseOrderLineId": {
                            "type": "string"
                          },
                          "position": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "description": {
                            "type": "string"
                          },
                          "supplyCategory": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "GOODS",
                                  "SERVICES",
                                  "INTANGIBLE_PROPERTY",
                                  "REAL_PROPERTY"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "isService": {
                            "type": "boolean"
                          },
                          "unit": {
                            "type": "string",
                            "const": "quantity"
                          },
                          "ordered": {
                            "type": "string",
                            "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                          },
                          "received": {
                            "type": "string",
                            "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                          },
                          "outstanding": {
                            "type": "string",
                            "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                          },
                          "mostAcceptable": {
                            "type": "string",
                            "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                          },
                          "confirmer": {
                            "type": "object",
                            "properties": {
                              "rule": {
                                "type": "string",
                                "enum": [
                                  "ANYONE",
                                  "REQUESTER"
                                ]
                              },
                              "requester": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "rule",
                              "requester"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "purchaseOrderLineId",
                          "position",
                          "description",
                          "supplyCategory",
                          "isService",
                          "unit",
                          "ordered",
                          "received",
                          "outstanding",
                          "mostAcceptable",
                          "confirmer"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "highestSequence": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "proposals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "sequence": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "proposedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "senderDomain": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "sequence",
                          "proposedAt",
                          "senderDomain"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "mayRecord": {
                      "type": "boolean"
                    },
                    "mayConfirmForOthers": {
                      "type": "boolean"
                    },
                    "today": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "purchaseOrderId",
                    "status",
                    "receivable",
                    "notReceivableWhy",
                    "tolerance",
                    "separation",
                    "lines",
                    "highestSequence",
                    "proposals",
                    "mayRecord",
                    "mayConfirmForOthers",
                    "today",
                    "entityTimeZone"
                  ],
                  "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/purchase-orders/{purchaseOrderId}/send-facts": {
      "get": {
        "operationId": "getPurchaseOrderSendFacts",
        "summary": "Returns the facts a notice about a purchase order is built from.",
        "description": "Returns the facts a notice about a purchase order is built from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "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": {
                    "recipients": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "email": {
                            "type": "string"
                          },
                          "role": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "source": {
                            "type": "string"
                          },
                          "new": {
                            "type": "boolean"
                          },
                          "stopped": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "email",
                          "role",
                          "source",
                          "new",
                          "stopped"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "language": {
                      "type": "string"
                    },
                    "frenchReviewed": {
                      "type": "boolean"
                    },
                    "sender": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "supplierContact": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "telephone": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "name",
                            "telephone"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "outboundApproved": {
                      "type": "boolean"
                    },
                    "preview": {
                      "type": "object",
                      "properties": {
                        "subject": {
                          "type": "string"
                        },
                        "text": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "subject",
                        "text"
                      ],
                      "additionalProperties": false
                    },
                    "documentUrl": {
                      "type": "string"
                    },
                    "alreadySent": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "recipientDomain": {
                            "type": "string"
                          },
                          "sentAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "sentBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "revision": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "recipientDomain",
                          "sentAt",
                          "sentBy",
                          "revision"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "recipients",
                    "language",
                    "frenchReviewed",
                    "sender",
                    "supplierContact",
                    "outboundApproved",
                    "preview",
                    "documentUrl",
                    "alreadySent"
                  ],
                  "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/purchase-orders/{purchaseOrderId}/submit": {
      "post": {
        "operationId": "submitPurchaseOrder",
        "summary": "Submits a purchase order for approval.",
        "description": "Submits a purchase order for approval. Needs the `ledger:propose` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "purchaseOrderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "askedApproverId": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "fxRate": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{1,6}(\\.\\d{1,6})?$"
                      },
                      {
                        "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/CreatePurchaseOrderResponse"
                }
              }
            }
          },
          "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/purchases-exports": {
      "post": {
        "operationId": "requestPurchasesExport",
        "summary": "Requests an export of the purchases lists.",
        "description": "Requests an export of the purchases lists. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "BILLS",
                      "VENDORS",
                      "PAYMENT_RUNS"
                    ]
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "CSV",
                      "XLSX"
                    ]
                  },
                  "query": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "kind",
                  "format",
                  "query"
                ],
                "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/RequestPurchasesExportResponseOption1"
                    },
                    {
                      "$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": "listPurchasesExports",
        "summary": "Lists the purchases exports, with the server's total.",
        "description": "Lists the purchases exports, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "QUEUED",
                "RUNNING",
                "READY",
                "FAILED",
                "EXPIRED"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BILLS",
                "VENDORS",
                "PAYMENT_RUNS"
              ]
            }
          },
          {
            "name": "show",
            "in": "query",
            "required": false,
            "schema": {
              "default": "mine",
              "type": "string",
              "enum": [
                "mine",
                "all"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "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/RequestPurchasesExportResponseOption1"
                      }
                    },
                    "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/purchases-exports/{exportId}": {
      "get": {
        "operationId": "getPurchasesExport",
        "summary": "Returns one purchases export and its status.",
        "description": "Returns one purchases export and its status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "exportId",
            "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": {
                    "export": {
                      "$ref": "#/components/schemas/RequestPurchasesExportResponseOption1"
                    },
                    "downloads": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "recent": {
                          "maxItems": 10,
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/LastReplayOption1"
                          }
                        }
                      },
                      "required": [
                        "total",
                        "recent"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "export",
                    "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/purchases-exports/{exportId}/link": {
      "get": {
        "operationId": "linkPurchasesExport",
        "summary": "Returns the link to download a purchases export.",
        "description": "Returns the link to download a purchases export. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "exportId",
            "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": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "expiresAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "fileName": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url",
                    "expiresAt",
                    "fileName"
                  ],
                  "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/purchases-list-views": {
      "get": {
        "operationId": "listPurchasesListViews",
        "summary": "Lists the saved views of the purchases lists.",
        "description": "Lists the saved views of the purchases lists. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "list",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/List"
            }
          }
        ],
        "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/ViewsItem3"
                      }
                    },
                    "mineCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "sharedCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "perListLimit": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "sharedLimit": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "notReady": {
                      "default": null,
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "views",
                    "mineCount",
                    "sharedCount",
                    "perListLimit",
                    "sharedLimit",
                    "notReady"
                  ],
                  "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": "savePurchasesListView",
        "summary": "Saves a view of a purchases list under a name.",
        "description": "Saves a view of a purchases list under a name. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "list": {
                    "$ref": "#/components/schemas/List"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "filters": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "source": {
                    "default": "PERSON",
                    "type": "string",
                    "enum": [
                      "PERSON",
                      "DRAFT"
                    ]
                  },
                  "draftPromptVersion": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  }
                },
                "required": [
                  "list",
                  "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/ViewsItem3"
                }
              }
            }
          },
          "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/purchases-list-views/{viewId}": {
      "patch": {
        "operationId": "updatePurchasesListView",
        "summary": "Changes a saved purchases list view.",
        "description": "Changes a saved purchases list view. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
                  },
                  "filters": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "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/ViewsItem3"
                }
              }
            }
          },
          "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": "deletePurchasesListView",
        "summary": "Deletes a saved purchases list view.",
        "description": "Deletes a saved purchases list view. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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/purchases-list-views/{viewId}/share": {
      "post": {
        "operationId": "sharePurchasesListView",
        "summary": "Shares a saved purchases list view with other seats.",
        "description": "Shares a saved purchases list view with other seats. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "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": {
                  "$ref": "#/components/schemas/ViewsItem3"
                }
              }
            }
          },
          "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/purchases-list-views/{viewId}/unshare": {
      "post": {
        "operationId": "unsharePurchasesListView",
        "summary": "Stops sharing a purchases list view.",
        "description": "Stops sharing a purchases list view. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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": {
                  "$ref": "#/components/schemas/ViewsItem3"
                }
              }
            }
          },
          "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/purchases-report-views": {
      "get": {
        "operationId": "listPurchasesReportViews",
        "summary": "Lists the saved views of the purchases reports.",
        "description": "Lists the saved views of the purchases reports. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "report",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Report"
            }
          }
        ],
        "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/ViewsItem2"
                      }
                    },
                    "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": "savePurchasesReportView",
        "summary": "Saves a view of a purchases report under a name.",
        "description": "Saves a view of a purchases report under a name. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "report": {
                    "$ref": "#/components/schemas/Report"
                  },
                  "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/ViewsItem2"
                }
              }
            }
          },
          "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/purchases-report-views/{viewId}": {
      "patch": {
        "operationId": "renamePurchasesReportView",
        "summary": "Renames a saved purchases report view.",
        "description": "Renames a saved purchases report view. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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/ViewsItem2"
                }
              }
            }
          },
          "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": "deletePurchasesReportView",
        "summary": "Deletes a saved purchases report view.",
        "description": "Deletes a saved purchases report view. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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/purchases-reports/{reportKey}": {
      "get": {
        "operationId": "purchasesReport",
        "summary": "Returns one purchases report for the period chosen.",
        "description": "Returns one purchases report for the period chosen. Needs the `statements:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "statements:read",
        "parameters": [
          {
            "name": "reportKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "accountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "dimensionTypeId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "dimensionValueId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "personId",
            "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": "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}$"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "slipKind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "T4A",
                "T5018"
              ]
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 400
            }
          },
          {
            "name": "groupBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "VENDOR",
                "ACCOUNT",
                "DIMENSION",
                "COMPANY",
                "ORDER"
              ]
            }
          },
          {
            "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": {
                      "$ref": "#/components/schemas/Report"
                    },
                    "group": {
                      "type": "string",
                      "enum": [
                        "SPEND",
                        "REGISTERS",
                        "EXCEPTIONS",
                        "CONTROLS"
                      ]
                    },
                    "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}$"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "dateMeaning": {
                      "type": "string",
                      "enum": [
                        "POSTED",
                        "BILL_DATE",
                        "PAID_ON",
                        "PERIOD_CONTAINING",
                        "AS_AT",
                        "PERIOD_END",
                        "WHEN",
                        "APPROVED",
                        "NONE",
                        "EXPECTED_BY"
                      ]
                    },
                    "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",
                              "actor"
                            ]
                          },
                          "total": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "field",
                          "label",
                          "kind",
                          "total"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "spendMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "itcMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "billCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "spend-by-vendor"
                              },
                              "vendor": {
                                "$ref": "#/components/schemas/Vendor2"
                              }
                            },
                            "required": [
                              "spendMinor",
                              "itcMinor",
                              "billCount",
                              "key",
                              "report",
                              "vendor"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "spendMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "budgetMinor": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "budgetLeftMinor": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "billCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "spend-by-account"
                              },
                              "account": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              }
                            },
                            "required": [
                              "spendMinor",
                              "budgetMinor",
                              "budgetLeftMinor",
                              "billCount",
                              "key",
                              "report",
                              "account"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "spendMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "budgetMinor": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "budgetLeftMinor": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "billCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "spend-by-month"
                              },
                              "month": {
                                "type": "string",
                                "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                              }
                            },
                            "required": [
                              "spendMinor",
                              "budgetMinor",
                              "budgetLeftMinor",
                              "billCount",
                              "key",
                              "report",
                              "month"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "spendMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "budgetMinor": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "budgetLeftMinor": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "billCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "spend-by-company"
                              },
                              "company": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              }
                            },
                            "required": [
                              "spendMinor",
                              "budgetMinor",
                              "budgetLeftMinor",
                              "billCount",
                              "key",
                              "report",
                              "company"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "spendMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "budgetMinor": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "budgetLeftMinor": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "billCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "spend-by-dimension"
                              },
                              "value": {
                                "$ref": "#/components/schemas/Vendor2"
                              },
                              "waitingMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "waitingBillCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "spendMinor",
                              "budgetMinor",
                              "budgetLeftMinor",
                              "billCount",
                              "key",
                              "report",
                              "value",
                              "waitingMinor",
                              "waitingBillCount"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "netMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "taxMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "totalMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "openMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "bill-register"
                              },
                              "bill": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "company": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "vendor": {
                                "$ref": "#/components/schemas/Vendor2"
                              },
                              "supplierName": {
                                "type": "string"
                              },
                              "number": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source": {
                                "type": "string"
                              },
                              "billDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "dueDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "DRAFT",
                                  "IN_REVIEW",
                                  "DECLINED",
                                  "APPROVED",
                                  "HELD",
                                  "OPEN",
                                  "DUE",
                                  "OVERDUE",
                                  "IN_RUN",
                                  "PARTIALLY_PAID",
                                  "PAID",
                                  "VOID"
                                ]
                              },
                              "onBooks": {
                                "type": "boolean"
                              },
                              "heldBackMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "releasedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "releaseOn": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "netMinor",
                              "taxMinor",
                              "totalMinor",
                              "openMinor",
                              "key",
                              "report",
                              "bill",
                              "company",
                              "vendor",
                              "supplierName",
                              "number",
                              "source",
                              "billDate",
                              "dueDate",
                              "status",
                              "onBooks",
                              "heldBackMinor",
                              "releasedMinor",
                              "releaseOn"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "paidMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "notCountedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "payment-register"
                              },
                              "paidOn": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "vendor": {
                                "$ref": "#/components/schemas/Vendor2"
                              },
                              "bill": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "method": {
                                "type": "string",
                                "enum": [
                                  "RUN",
                                  "CARD",
                                  "PAD",
                                  "ACCOUNT",
                                  "CHEQUE",
                                  "WIRE",
                                  "ETRANSFER",
                                  "OTHER"
                                ]
                              },
                              "run": {
                                "$ref": "#/components/schemas/Vendor2"
                              },
                              "reference": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "state": {
                                "type": "string",
                                "enum": [
                                  "PAID",
                                  "AWAITING_APPROVAL",
                                  "REVERSED",
                                  "VOIDED"
                                ]
                              },
                              "runReversal": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "REVERSED",
                                      "PARTLY_REVERSED"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "paidMinor",
                              "notCountedMinor",
                              "key",
                              "report",
                              "paidOn",
                              "vendor",
                              "bill",
                              "method",
                              "run",
                              "reference",
                              "state",
                              "runReversal"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "baseMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "taxPaidMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "itcMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "notClaimedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "tax-paid"
                              },
                              "source": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "vendor": {
                                "$ref": "#/components/schemas/Vendor2"
                              },
                              "entryDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              }
                            },
                            "required": [
                              "baseMinor",
                              "taxPaidMinor",
                              "itcMinor",
                              "notClaimedMinor",
                              "key",
                              "report",
                              "source",
                              "vendor",
                              "entryDate"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "dueMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "heldMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "inRunMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "discountDeadlineMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "discountKeptMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "billCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "cash-required"
                              },
                              "bucket": {
                                "type": "string",
                                "enum": [
                                  "OVERDUE",
                                  "WEEK",
                                  "LATER"
                                ]
                              },
                              "weekStart": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "dueMinor",
                              "heldMinor",
                              "inRunMinor",
                              "discountDeadlineMinor",
                              "discountKeptMinor",
                              "billCount",
                              "key",
                              "report",
                              "bucket",
                              "weekStart"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "itc-at-risk"
                              },
                              "source": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "vendor": {
                                "$ref": "#/components/schemas/Vendor2"
                              },
                              "billDate": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "outcome": {
                                "type": "string",
                                "enum": [
                                  "FAILS",
                                  "UNTESTED",
                                  "NOT_TESTED",
                                  "PASSES"
                                ]
                              },
                              "reasons": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "itcMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              }
                            },
                            "required": [
                              "key",
                              "report",
                              "source",
                              "vendor",
                              "billDate",
                              "outcome",
                              "reasons",
                              "itcMinor"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "unexplained-payable"
                              },
                              "entry": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "entryDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "account": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "memo": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "sourceKind": {
                                "type": "string",
                                "enum": [
                                  "MANUAL",
                                  "AGENT_PROPOSAL",
                                  "RECURRING",
                                  "REVERSAL",
                                  "IMPORT",
                                  "CHAT",
                                  "MIGRATION",
                                  "PAYMENT_RUN",
                                  "INVOICE",
                                  "RECEIPT",
                                  "BILL",
                                  "BILL_SETTLEMENT",
                                  "VENDOR_CREDIT"
                                ]
                              },
                              "amountMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              }
                            },
                            "required": [
                              "key",
                              "report",
                              "entry",
                              "entryDate",
                              "account",
                              "memo",
                              "sourceKind",
                              "amountMinor"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "amountMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "exceptionMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "subsequent-payments"
                              },
                              "paidOn": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "payee": {
                                "$ref": "#/components/schemas/Vendor2"
                              },
                              "payeeName": {
                                "type": "string"
                              },
                              "bill": {
                                "$ref": "#/components/schemas/Vendor2"
                              },
                              "billDate": {
                                "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"
                                  }
                                ]
                              },
                              "booksDate": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "class": {
                                "type": "string",
                                "enum": [
                                  "NOT_IN_PERIOD_BOOKS",
                                  "NO_BILL",
                                  "ENTERED_LATE",
                                  "IN_BOOKS",
                                  "AFTER_PERIOD_END"
                                ]
                              }
                            },
                            "required": [
                              "amountMinor",
                              "exceptionMinor",
                              "key",
                              "report",
                              "paidOn",
                              "payee",
                              "payeeName",
                              "bill",
                              "billDate",
                              "servicePeriodEnd",
                              "booksDate",
                              "class"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "paidMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "computedBoxMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "boxMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "slip-reconciliation"
                              },
                              "vendor": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "slipKind": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "T4A",
                                      "T5018"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "outcome": {
                                "type": "string",
                                "enum": [
                                  "IN_FILE",
                                  "BLOCKED",
                                  "UNDER_THRESHOLD",
                                  "NOT_FLAGGED_OVER",
                                  "NOT_FLAGGED"
                                ]
                              },
                              "reasons": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "paidMinor",
                              "computedBoxMinor",
                              "boxMinor",
                              "key",
                              "report",
                              "vendor",
                              "slipKind",
                              "outcome",
                              "reasons"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "approvals"
                              },
                              "at": {
                                "type": "string",
                                "minLength": 20
                              },
                              "action": {
                                "type": "string"
                              },
                              "what": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "ATTESTATION",
                                  "REFUSAL",
                                  "FIRING"
                                ]
                              },
                              "subject": {
                                "$ref": "#/components/schemas/Vendor2"
                              },
                              "actor": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "PERSON",
                                      "ASSISTANT",
                                      "SYSTEM",
                                      "LINK"
                                    ]
                                  },
                                  "person": {
                                    "$ref": "#/components/schemas/Vendor2"
                                  }
                                },
                                "required": [
                                  "type",
                                  "person"
                                ],
                                "additionalProperties": false
                              },
                              "rule": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "detail": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "key",
                              "report",
                              "at",
                              "action",
                              "what",
                              "kind",
                              "subject",
                              "actor",
                              "rule",
                              "detail"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "own-work-approvals"
                              },
                              "bill": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "company": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "supplierName": {
                                "type": "string"
                              },
                              "billDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "totalMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "approvedAt": {
                                "type": "string",
                                "minLength": 20
                              },
                              "approvedBy": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "coincidence": {
                                "type": "string",
                                "enum": [
                                  "DRAFTER",
                                  "SUBMITTER",
                                  "BOTH"
                                ]
                              },
                              "allowedBy": {
                                "$ref": "#/components/schemas/Vendor2"
                              }
                            },
                            "required": [
                              "key",
                              "report",
                              "bill",
                              "company",
                              "supplierName",
                              "billDate",
                              "currency",
                              "totalMinor",
                              "approvedAt",
                              "approvedBy",
                              "coincidence",
                              "allowedBy"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "orderCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "orderedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "invoicedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "openMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "receivedNotInvoicedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "onOrderMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "open-commitments"
                              },
                              "groupBy": {
                                "type": "string",
                                "enum": [
                                  "VENDOR",
                                  "ACCOUNT",
                                  "DIMENSION",
                                  "COMPANY",
                                  "ORDER"
                                ]
                              },
                              "group": {
                                "$ref": "#/components/schemas/Vendor2"
                              }
                            },
                            "required": [
                              "orderCount",
                              "orderedMinor",
                              "invoicedMinor",
                              "openMinor",
                              "receivedNotInvoicedMinor",
                              "onOrderMinor",
                              "key",
                              "report",
                              "groupBy",
                              "group"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "totalMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "releasedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "remainingMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "prepaid-schedule"
                              },
                              "scheduleId": {
                                "type": "string"
                              },
                              "bill": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "vendorName": {
                                "type": "string"
                              },
                              "lineNumber": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 9007199254740991
                              },
                              "prepaidAccount": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "releaseAccount": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "ACTIVE",
                                  "COMPLETE",
                                  "DECLINED",
                                  "VOID"
                                ]
                              },
                              "periodStart": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "periodEnd": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "nextRelease": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "totalMinor",
                              "releasedMinor",
                              "remainingMinor",
                              "key",
                              "report",
                              "scheduleId",
                              "bill",
                              "vendorName",
                              "lineNumber",
                              "prepaidAccount",
                              "releaseAccount",
                              "status",
                              "periodStart",
                              "periodEnd",
                              "nextRelease"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "cut-off"
                              },
                              "bill": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "vendorName": {
                                "type": "string"
                              },
                              "lineNumber": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 9007199254740991
                              },
                              "accountCode": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "belongsOn": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "booksOn": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "class": {
                                "type": "string",
                                "enum": [
                                  "IN_REVIEW",
                                  "POSTED_LATER"
                                ]
                              },
                              "amountMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              }
                            },
                            "required": [
                              "key",
                              "report",
                              "bill",
                              "vendorName",
                              "lineNumber",
                              "accountCode",
                              "belongsOn",
                              "booksOn",
                              "class",
                              "amountMinor"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "retainedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "releasedMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "remainingMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "key": {
                                "type": "string"
                              },
                              "report": {
                                "type": "string",
                                "const": "holdbacks-held"
                              },
                              "bill": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "vendor": {
                                "$ref": "#/components/schemas/Vendor2"
                              },
                              "company": {
                                "$ref": "#/components/schemas/Vendor2Option1"
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "releaseOn": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "state": {
                                "type": "string",
                                "enum": [
                                  "RETAINED",
                                  "RELEASE_DUE",
                                  "RELEASE_DRAFTED",
                                  "PART_RELEASED"
                                ]
                              }
                            },
                            "required": [
                              "retainedMinor",
                              "releasedMinor",
                              "remainingMinor",
                              "key",
                              "report",
                              "bill",
                              "vendor",
                              "company",
                              "currency",
                              "releaseOn",
                              "state"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "rowCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "totalRow": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "spendMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "itcMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "billCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "report": {
                              "type": "string",
                              "const": "spend-by-vendor"
                            }
                          },
                          "required": [
                            "spendMinor",
                            "itcMinor",
                            "billCount",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "spendMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "budgetMinor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "budgetLeftMinor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "billCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "report": {
                              "type": "string",
                              "const": "spend-by-account"
                            }
                          },
                          "required": [
                            "spendMinor",
                            "budgetMinor",
                            "budgetLeftMinor",
                            "billCount",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "spendMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "budgetMinor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "budgetLeftMinor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "billCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "report": {
                              "type": "string",
                              "const": "spend-by-month"
                            }
                          },
                          "required": [
                            "spendMinor",
                            "budgetMinor",
                            "budgetLeftMinor",
                            "billCount",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "spendMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "budgetMinor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "budgetLeftMinor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "billCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "report": {
                              "type": "string",
                              "const": "spend-by-company"
                            }
                          },
                          "required": [
                            "spendMinor",
                            "budgetMinor",
                            "budgetLeftMinor",
                            "billCount",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "spendMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "budgetMinor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "budgetLeftMinor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "billCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "report": {
                              "type": "string",
                              "const": "spend-by-dimension"
                            },
                            "waitingMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "waitingBillCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "spendMinor",
                            "budgetMinor",
                            "budgetLeftMinor",
                            "billCount",
                            "report",
                            "waitingMinor",
                            "waitingBillCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "netMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "taxMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "totalMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "openMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "report": {
                              "type": "string",
                              "const": "bill-register"
                            },
                            "billCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "netMinor",
                            "taxMinor",
                            "totalMinor",
                            "openMinor",
                            "report",
                            "billCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "paidMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "notCountedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "report": {
                              "type": "string",
                              "const": "payment-register"
                            },
                            "paymentCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "paidMinor",
                            "notCountedMinor",
                            "report",
                            "paymentCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "baseMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "taxPaidMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "itcMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "notClaimedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "report": {
                              "type": "string",
                              "const": "tax-paid"
                            },
                            "sourceCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "baseMinor",
                            "taxPaidMinor",
                            "itcMinor",
                            "notClaimedMinor",
                            "report",
                            "sourceCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "dueMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "heldMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "inRunMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "discountDeadlineMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "discountKeptMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "billCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "report": {
                              "type": "string",
                              "const": "cash-required"
                            }
                          },
                          "required": [
                            "dueMinor",
                            "heldMinor",
                            "inRunMinor",
                            "discountDeadlineMinor",
                            "discountKeptMinor",
                            "billCount",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "report": {
                              "type": "string",
                              "const": "itc-at-risk"
                            },
                            "itcMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "failCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "untestedCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "notTestedCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "passCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "failItcMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "untestedItcMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "notTestedItcMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "passItcMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            }
                          },
                          "required": [
                            "report",
                            "itcMinor",
                            "failCount",
                            "untestedCount",
                            "notTestedCount",
                            "passCount",
                            "failItcMinor",
                            "untestedItcMinor",
                            "notTestedItcMinor",
                            "passItcMinor"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "report": {
                              "type": "string",
                              "const": "unexplained-payable"
                            },
                            "amountMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "lineCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "report",
                            "amountMinor",
                            "lineCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "amountMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "exceptionMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "report": {
                              "type": "string",
                              "const": "subsequent-payments"
                            },
                            "paymentCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "exceptionCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "amountMinor",
                            "exceptionMinor",
                            "report",
                            "paymentCount",
                            "exceptionCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "paidMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "computedBoxMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "boxMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "report": {
                              "type": "string",
                              "const": "slip-reconciliation"
                            },
                            "vendorCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "inFileCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "paidMinor",
                            "computedBoxMinor",
                            "boxMinor",
                            "report",
                            "vendorCount",
                            "inFileCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "report": {
                              "type": "string",
                              "const": "approvals"
                            },
                            "rowCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "attestationCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "refusalCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "firingCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "report",
                            "rowCount",
                            "attestationCount",
                            "refusalCount",
                            "firingCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "report": {
                              "type": "string",
                              "const": "own-work-approvals"
                            },
                            "billCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "report",
                            "billCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "orderCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "orderedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "invoicedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "openMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "receivedNotInvoicedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "onOrderMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "report": {
                              "type": "string",
                              "const": "open-commitments"
                            }
                          },
                          "required": [
                            "orderCount",
                            "orderedMinor",
                            "invoicedMinor",
                            "openMinor",
                            "receivedNotInvoicedMinor",
                            "onOrderMinor",
                            "report"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "totalMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "releasedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "remainingMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "report": {
                              "type": "string",
                              "const": "prepaid-schedule"
                            },
                            "scheduleCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "totalMinor",
                            "releasedMinor",
                            "remainingMinor",
                            "report",
                            "scheduleCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "report": {
                              "type": "string",
                              "const": "cut-off"
                            },
                            "amountMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "lineCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "report",
                            "amountMinor",
                            "lineCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "retainedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "releasedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "remainingMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "report": {
                              "type": "string",
                              "const": "holdbacks-held"
                            },
                            "billCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "retainedMinor",
                            "releasedMinor",
                            "remainingMinor",
                            "report",
                            "billCount"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "tieOut": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "label": {
                              "type": "string"
                            },
                            "reportMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "againstMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "differenceMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            }
                          },
                          "required": [
                            "label",
                            "reportMinor",
                            "againstMinor",
                            "differenceMinor"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "exceptionNote": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "sentence": {
                              "type": "string"
                            },
                            "citation": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "sentence",
                            "citation"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "filters": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "report",
                    "group",
                    "title",
                    "description",
                    "currency",
                    "asOf",
                    "entityTimeZone",
                    "dateMeaning",
                    "columns",
                    "rows",
                    "nextCursor",
                    "rowCount",
                    "totalRow",
                    "tieOut",
                    "exceptionNote",
                    "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/purchases-settings": {
      "get": {
        "operationId": "getPurchasesSettings",
        "summary": "Returns the purchases settings of the ledger.",
        "description": "Returns the purchases settings of the ledger. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "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": {
                  "$ref": "#/components/schemas/GetPurchasesSettingsResponse"
                }
              }
            }
          },
          "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/purchases-settings/inbox-advice/dismiss": {
      "post": {
        "operationId": "dismissInboxPolicyAdvice",
        "summary": "Dismisses advice about the inbox policy.",
        "description": "Dismisses advice about the inbox policy. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
                  },
                  "digest": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                },
                "required": [
                  "entityId",
                  "digest"
                ],
                "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/GetPurchasesSettingsResponse"
                }
              }
            }
          },
          "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/purchases-settings/paper-requirements/apply": {
      "post": {
        "operationId": "applyPaperRequirements",
        "summary": "Starts applying the paper requirements to the vendors they name, as a job you follow.",
        "description": "Starts applying the paper requirements to the vendors they name, as a job you follow. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kinds": {
                    "minItems": 1,
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "WSIB_CLEARANCE",
                        "INSURANCE_CERTIFICATE",
                        "MASTER_AGREEMENT",
                        "W8BEN",
                        "DIRECT_DEPOSIT_FORM",
                        "WITHHOLDING_WAIVER",
                        "OTHER"
                      ]
                    }
                  },
                  "slipKind": {
                    "type": "string",
                    "enum": [
                      "NONE",
                      "T4A",
                      "T5018",
                      "T4A_NR"
                    ]
                  },
                  "expectedCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kinds",
                  "expectedCount"
                ],
                "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/purchases-settings/paper-requirements/preview": {
      "get": {
        "operationId": "previewPaperRequirements",
        "summary": "Previews the paper requirements before they are applied.",
        "description": "Previews the paper requirements before they are applied. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "kinds",
            "in": "query",
            "required": true,
            "description": "One or more document kinds, separated by commas.",
            "schema": {
              "type": "string",
              "description": "One or more document kinds, separated by commas."
            }
          },
          {
            "name": "slipKind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NONE",
                "T4A",
                "T5018",
                "T4A_NR"
              ]
            }
          }
        ],
        "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": {
                    "kinds": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "WSIB_CLEARANCE",
                          "INSURANCE_CERTIFICATE",
                          "MASTER_AGREEMENT",
                          "W8BEN",
                          "DIRECT_DEPOSIT_FORM",
                          "WITHHOLDING_WAIVER",
                          "OTHER"
                        ]
                      }
                    },
                    "slipKind": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "NONE",
                            "T4A",
                            "T5018",
                            "T4A_NR"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "wouldChange": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "withoutPaper": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "sample": {
                      "maxItems": 10,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "displayName"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "kinds",
                    "slipKind",
                    "wouldChange",
                    "withoutPaper",
                    "sample"
                  ],
                  "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/purchases-settings/self-approved-bills": {
      "get": {
        "operationId": "listSelfApprovedBills",
        "summary": "Lists the bills a person approved themselves.",
        "description": "Lists the bills a person approved themselves. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "approvedFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "approvedTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "coincidence",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DRAFTER",
                "SUBMITTER",
                "BOTH"
              ]
            }
          },
          {
            "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": {
                          "billId": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "supplierName": {
                            "type": "string"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "approvedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "approvedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "preparedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "submittedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "coincidence": {
                            "type": "string",
                            "enum": [
                              "DRAFTER",
                              "SUBMITTER",
                              "BOTH"
                            ]
                          },
                          "allowedBy": {
                            "$ref": "#/components/schemas/ApprovedUnder"
                          },
                          "ownWorkAuthority": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "origin": {
                                    "type": "string",
                                    "enum": [
                                      "CARRIED_OVER",
                                      "PERSON",
                                      "IMPORT"
                                    ]
                                  },
                                  "ownWorkCapMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  },
                                  "setBy": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "name"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "effectiveFrom": {
                                    "type": "string",
                                    "minLength": 20
                                  }
                                },
                                "required": [
                                  "id",
                                  "origin",
                                  "ownWorkCapMinor",
                                  "currency",
                                  "setBy",
                                  "effectiveFrom"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "billId",
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "supplierName",
                          "number",
                          "billDate",
                          "currency",
                          "totalMinor",
                          "approvedAt",
                          "approvedBy",
                          "preparedBy",
                          "submittedBy",
                          "coincidence",
                          "allowedBy",
                          "ownWorkAuthority"
                        ],
                        "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/purchases-summary": {
      "get": {
        "operationId": "getPurchasesSummary",
        "summary": "Returns the purchases summary for the ledger over a period.",
        "description": "Returns the purchases summary for the ledger over a period. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "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": {
                    "entity": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "functionalCurrency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "functionalCurrency"
                      ],
                      "additionalProperties": false
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "readAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "today": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "weekEnd": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "money": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "READ"
                            },
                            "owed": {
                              "$ref": "#/components/schemas/Totals3"
                            },
                            "overdue": {
                              "$ref": "#/components/schemas/Totals3"
                            },
                            "dueThisWeek": {
                              "$ref": "#/components/schemas/Totals3"
                            },
                            "draftRuns": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  },
                                  "totalMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "runCount": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "currency",
                                  "totalMinor",
                                  "runCount"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "heldInWeek": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "paidOtherWayInWeek": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "heldBack": {
                              "anyOf": [
                                {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "entityId": {
                                        "type": "string"
                                      },
                                      "currency": {
                                        "type": "string"
                                      },
                                      "remainingMinor": {
                                        "type": "string",
                                        "pattern": "^-?\\d+$"
                                      }
                                    },
                                    "required": [
                                      "entityId",
                                      "currency",
                                      "remainingMinor"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "state",
                            "owed",
                            "overdue",
                            "dueThisWeek",
                            "draftRuns",
                            "heldInWeek",
                            "paidOtherWayInWeek",
                            "heldBack"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "UNREAD"
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "ageing": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "asOf": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "entity": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "timeZone": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "timeZone"
                              ],
                              "additionalProperties": false
                            },
                            "currency": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            "totals": {
                              "$ref": "#/components/schemas/Totals4"
                            },
                            "openBillCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "heldBillCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "tie": {
                              "$ref": "#/components/schemas/TieOption1"
                            },
                            "state": {
                              "type": "string",
                              "const": "READ"
                            }
                          },
                          "required": [
                            "asOf",
                            "entity",
                            "currency",
                            "totals",
                            "openBillCount",
                            "heldBillCount",
                            "tie",
                            "state"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "UNREAD"
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "dueFirst": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "READ"
                            },
                            "rows": {
                              "maxItems": 5,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "billId": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "supplierName": {
                                    "type": "string"
                                  },
                                  "vendor": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "displayName": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "displayName"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "dueDate": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "overdueDays": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  },
                                  "openMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  }
                                },
                                "required": [
                                  "billId",
                                  "number",
                                  "supplierName",
                                  "vendor",
                                  "dueDate",
                                  "overdueDays",
                                  "currency",
                                  "openMinor"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "total": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "state",
                            "rows",
                            "total"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "UNREAD"
                            }
                          },
                          "required": [
                            "state"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "work": {
                      "type": "object",
                      "properties": {
                        "waitingOnYou": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/WaitingOnYouOption1"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "inReview": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "runsToRelease": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "bankingToVerify": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "toAccept": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "notReviewed": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "mergesWaiting": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "lookAlikes": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "documentsStopped": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "const": "READ"
                                },
                                "count": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "unreadable": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "oldestOn": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "oldestDays": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "count",
                                "unreadable",
                                "oldestOn",
                                "oldestDays"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "const": "UNREAD"
                                }
                              },
                              "required": [
                                "state"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        },
                        "signalsOpen": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "discountsOpen": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "const": "READ"
                                },
                                "count": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "firstClosesOn": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "kept": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "currency": {
                                        "type": "string",
                                        "pattern": "^[A-Z]{3}$"
                                      },
                                      "discountMinor": {
                                        "type": "string",
                                        "pattern": "^-?\\d+$"
                                      }
                                    },
                                    "required": [
                                      "currency",
                                      "discountMinor"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "state",
                                "count",
                                "firstClosesOn",
                                "kept"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "const": "UNREAD"
                                }
                              },
                              "required": [
                                "state"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        },
                        "toReceive": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "slipsProposed": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "billsNotArrived": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "holdbacksDue": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "privacyDue": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "const": "READ"
                                },
                                "count": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "overdue": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "soonestDueOn": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "state",
                                "count",
                                "overdue",
                                "soonestDueOn"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "state": {
                                  "type": "string",
                                  "const": "UNREAD"
                                }
                              },
                              "required": [
                                "state"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        },
                        "portalWaiting": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "billQuestionsOnYou": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "supplierQuestions": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "statementsToReview": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "cardReceiptsNoLine": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        },
                        "cardLinesNeedReceipt": {
                          "$ref": "#/components/schemas/WaitingOnYouOption1"
                        }
                      },
                      "required": [
                        "waitingOnYou",
                        "inReview",
                        "runsToRelease",
                        "bankingToVerify",
                        "toAccept",
                        "notReviewed",
                        "mergesWaiting",
                        "lookAlikes",
                        "documentsStopped",
                        "signalsOpen",
                        "discountsOpen",
                        "toReceive",
                        "slipsProposed",
                        "billsNotArrived",
                        "holdbacksDue",
                        "privacyDue",
                        "portalWaiting",
                        "billQuestionsOnYou",
                        "supplierQuestions",
                        "statementsToReview",
                        "cardReceiptsNoLine",
                        "cardLinesNeedReceipt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "entity",
                    "entityTimeZone",
                    "readAt",
                    "today",
                    "weekEnd",
                    "money",
                    "ageing",
                    "dueFirst",
                    "work"
                  ],
                  "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/purchases/custom-field-values/{recordKind}/{recordId}": {
      "put": {
        "operationId": "setPurchasesCustomFieldValues",
        "summary": "Sets custom field values on a vendor, bill or purchase order. Send only changed fields: null clears one, one left out is kept.",
        "description": "Sets custom field values on a vendor, bill or purchase order. Send only changed fields: null clears one, one left out is kept. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "recordKind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetCustomFieldValuesRequest"
              }
            }
          }
        },
        "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": {
                    "recordKind": {
                      "type": "string",
                      "enum": [
                        "VENDOR",
                        "BILL",
                        "PURCHASE_ORDER"
                      ]
                    },
                    "recordId": {
                      "type": "string"
                    },
                    "customFields": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "boolean"
                          },
                          {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "recordKind",
                    "recordId",
                    "customFields"
                  ],
                  "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/questions": {
      "get": {
        "operationId": "listQuestions",
        "summary": "Lists the questions the ledger has raised for a person, with the server's total.",
        "description": "Lists the questions the ledger has raised for a person, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "ANSWERED",
                "RESOLVED"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "mine",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "sent",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "entryId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "sourceTransactionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "billId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "billExtractionId",
            "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": {
                  "$ref": "#/components/schemas/ListQuestionsResponse"
                }
              }
            }
          },
          "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": "askQuestion",
        "summary": "Asks a person a question the ledger needs answered.",
        "description": "Asks a person a question the ledger needs answered. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "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
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "askedOfId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "topic": {
                    "type": "string",
                    "enum": [
                      "AMOUNT",
                      "SUPPLIER",
                      "CODING",
                      "TAX",
                      "DUPLICATE",
                      "OTHER"
                    ]
                  },
                  "textSource": {
                    "default": "PERSON",
                    "type": "string",
                    "enum": [
                      "PERSON",
                      "AGENT_DRAFT",
                      "AGENT_DRAFT_EDITED"
                    ]
                  },
                  "draftPromptVersion": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "discardedDraftPromptVersion": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "entryId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "sourceTransactionId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "billId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "billExtractionId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "entityId",
                  "text"
                ],
                "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/ListQuestionsResponseItem"
                }
              }
            }
          },
          "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/questions/digests": {
      "post": {
        "operationId": "composeQuestionDigest",
        "summary": "Composes the digest of open questions for a person.",
        "description": "Composes the digest of open questions for a person. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "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
                  },
                  "includeSent": {
                    "type": "boolean"
                  }
                },
                "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/ComposeQuestionDigestResponse"
                }
              }
            }
          },
          "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": "listQuestionDigests",
        "summary": "Lists the question digests that were composed.",
        "description": "Lists the question digests that were composed. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "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": {
                        "$ref": "#/components/schemas/ComposeQuestionDigestResponse"
                      }
                    },
                    "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/questions/{questionId}/answer": {
      "post": {
        "operationId": "answerQuestion",
        "summary": "Answers a question the ledger raised.",
        "description": "Answers a question the ledger raised. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "questionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "answer": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  }
                },
                "required": [
                  "answer"
                ],
                "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/ListQuestionsResponseItem"
                }
              }
            }
          },
          "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/questions/{questionId}/resolve": {
      "post": {
        "operationId": "resolveQuestion",
        "summary": "Resolves an answered question, with a reason.",
        "description": "Resolves an answered question, with a reason. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "questionId",
            "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": 1,
                    "maxLength": 2000
                  },
                  "rule": {
                    "type": "object",
                    "properties": {
                      "memoContains": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 120
                      },
                      "correctAccountCode": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40
                      }
                    },
                    "required": [
                      "memoContains",
                      "correctAccountCode"
                    ],
                    "additionalProperties": false
                  },
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "NO_CHANGE",
                      "APPROVED",
                      "HELD",
                      "SENT_BACK",
                      "EDITED",
                      "SUPPLIER_ASKED",
                      "VOIDED"
                    ]
                  }
                },
                "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/ListQuestionsResponseItem"
                }
              }
            }
          },
          "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/recon/accounts": {
      "get": {
        "operationId": "reconWorkspace",
        "summary": "Returns the reconciliation workspace for the bank accounts.",
        "description": "Returns the reconciliation workspace for the bank accounts. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "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": "financialAccountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "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": {
                    "asOf": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "timeZone": {
                      "type": "string"
                    },
                    "accounts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "BANK",
                              "CARD",
                              "STRIPE"
                            ]
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "glAccountId": {
                            "type": "string"
                          },
                          "glAccountCode": {
                            "type": "string"
                          },
                          "glAccountName": {
                            "type": "string"
                          },
                          "aggregator": {
                            "type": "string"
                          },
                          "lastSyncAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "bankBalanceMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "ledgerBalanceMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "unmatchedActivityMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "certifiedDifferenceMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "foreignCurrencyLineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "foreignCurrencies": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            }
                          },
                          "foreignCurrencyStagedLineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "foreignStagedCurrencies": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            }
                          },
                          "unmatchedCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "unmatchedOver7Days": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "proposedCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "suggestedCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "excludedCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "excludedTotalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "matchedCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "unassignedLineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "heldLineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "matchesAgainstReversedEntries": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "certifiedThrough": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "certification": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "periodLabel": {
                                    "type": "string"
                                  },
                                  "certifiedBy": {
                                    "type": "string"
                                  },
                                  "certifiedAt": {
                                    "type": "string",
                                    "minLength": 20
                                  }
                                },
                                "required": [
                                  "id",
                                  "periodLabel",
                                  "certifiedBy",
                                  "certifiedAt"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "withdrawnCertification": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "periodLabel": {
                                    "type": "string"
                                  },
                                  "withdrawnBy": {
                                    "type": "string"
                                  },
                                  "withdrawnAt": {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  "reason": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "periodLabel",
                                  "withdrawnBy",
                                  "withdrawnAt",
                                  "reason"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "certifiedThroughStale": {
                            "type": "boolean"
                          },
                          "certifiablePeriods": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "periodYear": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "periodMonth": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 12
                                },
                                "label": {
                                  "type": "string"
                                },
                                "endsOn": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "ledgerBalanceMinor": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                }
                              },
                              "required": [
                                "periodYear",
                                "periodMonth",
                                "label",
                                "endsOn",
                                "ledgerBalanceMinor"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "feedProblem": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "NO_CONNECTION",
                                      "REAUTH_NEEDED",
                                      "DISABLED",
                                      "STALE",
                                      "NEVER_SYNCED"
                                    ]
                                  },
                                  "message": {
                                    "type": "string"
                                  },
                                  "remedy": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "message",
                                  "remedy"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lastScanAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lastScanTruncated": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "displayName",
                          "kind",
                          "currency",
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "glAccountId",
                          "glAccountCode",
                          "glAccountName",
                          "aggregator",
                          "lastSyncAt",
                          "bankBalanceMinor",
                          "ledgerBalanceMinor",
                          "unmatchedActivityMinor",
                          "certifiedDifferenceMinor",
                          "foreignCurrencyLineCount",
                          "foreignCurrencies",
                          "foreignCurrencyStagedLineCount",
                          "foreignStagedCurrencies",
                          "unmatchedCount",
                          "unmatchedOver7Days",
                          "proposedCount",
                          "suggestedCount",
                          "excludedCount",
                          "excludedTotalMinor",
                          "matchedCount",
                          "unassignedLineCount",
                          "heldLineCount",
                          "matchesAgainstReversedEntries",
                          "certifiedThrough",
                          "certification",
                          "withdrawnCertification",
                          "certifiedThroughStale",
                          "certifiablePeriods",
                          "feedProblem",
                          "lastScanAt",
                          "lastScanTruncated"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "accountsTotal": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "accountsTruncated": {
                      "type": "boolean"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "feedProblems": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "unmatchedOver7Days": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "suggestedTotal": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "asOf",
                    "timeZone",
                    "accounts",
                    "accountsTotal",
                    "accountsTruncated",
                    "nextCursor",
                    "feedProblems",
                    "unmatchedOver7Days",
                    "suggestedTotal"
                  ],
                  "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/recon/certifications": {
      "get": {
        "operationId": "listReconCertifications",
        "summary": "Lists the reconciliation certifications.",
        "description": "Lists the reconciliation certifications. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "financialAccountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "includeWithdrawn",
            "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/ListReconCertificationsResponseItem"
                      }
                    },
                    "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": "certifyReconAccount",
        "summary": "Certifies that a bank account reconciles to a date.",
        "description": "Certifies that a bank account reconciles to a date. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "financialAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "periodYear": {
                    "type": "integer",
                    "minimum": 1900,
                    "maximum": 2999
                  },
                  "periodMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "statementBalanceMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "acceptDifference": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "financialAccountId",
                  "periodYear",
                  "periodMonth",
                  "statementBalanceMinor"
                ],
                "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/ListReconCertificationsResponseItem"
                }
              }
            }
          },
          "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/recon/certifications/{certificationId}/withdraw": {
      "post": {
        "operationId": "withdrawReconCertification",
        "summary": "Withdraws a reconciliation certification.",
        "description": "Withdraws a reconciliation certification. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "certificationId",
            "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/ListReconCertificationsResponseItem"
                }
              }
            }
          },
          "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/recon/lines": {
      "get": {
        "operationId": "listReconLines",
        "summary": "Lists the bank lines waiting to be reconciled, with the server's total.",
        "description": "Lists the bank lines waiting to be reconciled, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "financialAccountId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "filter",
            "in": "query",
            "required": false,
            "schema": {
              "default": "ALL",
              "type": "string",
              "enum": [
                "ALL",
                "PROPOSED",
                "NEEDS_INPUT",
                "MATCHED",
                "EXCLUDED"
              ]
            }
          },
          {
            "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": {
                          "line": {
                            "$ref": "#/components/schemas/Line"
                          },
                          "proposals": {
                            "$ref": "#/components/schemas/Proposals"
                          },
                          "matchedProposalId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "matchedEntryIds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "matchId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "matchedShape": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "ONE_TO_ONE",
                                  "ONE_TO_MANY",
                                  "MANY_TO_ONE",
                                  "SPLIT"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "matchedEvidence": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "excludedReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "matchedInvoices": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "invoiceId": {
                                  "type": "string"
                                },
                                "number": {
                                  "type": "string"
                                },
                                "customerName": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "invoiceId",
                                "number",
                                "customerName"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "matchedReceiptId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "line",
                          "proposals",
                          "matchedProposalId",
                          "matchedEntryIds",
                          "matchId",
                          "matchedShape",
                          "matchedEvidence",
                          "excludedReason",
                          "matchedInvoices",
                          "matchedReceiptId"
                        ],
                        "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/recon/lines/{sourceTransactionId}/exclude": {
      "post": {
        "operationId": "excludeReconLine",
        "summary": "Excludes a bank line from reconciliation with a reason.",
        "description": "Excludes a bank line from reconciliation with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "sourceTransactionId",
            "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": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "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/recon/matches/{matchId}/unmatch": {
      "post": {
        "operationId": "unmatchReconMatch",
        "summary": "Removes a reconciliation match.",
        "description": "Removes a reconciliation match. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "matchId",
            "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": {
                  "type": "object",
                  "properties": {
                    "matchIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "proposalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "bankLineIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "bankLinesWithDraftedEntry": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "journalLineIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "reason": {
                      "type": "string"
                    },
                    "undoneAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "undoneBy": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "matchIds",
                    "proposalId",
                    "bankLineIds",
                    "bankLinesWithDraftedEntry",
                    "journalLineIds",
                    "reason",
                    "undoneAt",
                    "undoneBy"
                  ],
                  "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/recon/proposals/{proposalId}/accept": {
      "post": {
        "operationId": "acceptReconMatch",
        "summary": "Accepts a proposed reconciliation match.",
        "description": "Accepts a proposed reconciliation match. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "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": {
                  "scoreBp": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000
                  }
                },
                "required": [
                  "scoreBp"
                ],
                "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/ProposalsItem"
                }
              }
            }
          },
          "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/recon/proposals/{proposalId}/record-receipt": {
      "post": {
        "operationId": "recordReceiptFromReconProposal",
        "summary": "Records a received payment from a reconciliation proposal.",
        "description": "Records a received payment from a reconciliation proposal. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "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": 500
                  }
                },
                "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": {
                  "type": "object",
                  "properties": {
                    "receipt": {
                      "$ref": "#/components/schemas/RecordReceiptResponse"
                    },
                    "matchId": {
                      "type": "string"
                    },
                    "invoices": {
                      "minItems": 1,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "number": {
                            "type": "string"
                          },
                          "appliedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "id",
                          "number",
                          "appliedMinor"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "receipt",
                    "matchId",
                    "invoices"
                  ],
                  "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/recon/proposals/{proposalId}/reject": {
      "post": {
        "operationId": "rejectReconMatch",
        "summary": "Rejects a proposed reconciliation match.",
        "description": "Rejects a proposed reconciliation match. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "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": 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/ProposalsItem"
                }
              }
            }
          },
          "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/recon/proposals/{proposalId}/settle": {
      "post": {
        "operationId": "settleReconProposal",
        "summary": "Settles a reconciliation proposal, which posts its match.",
        "description": "Settles a reconciliation proposal, which posts its match. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "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": {
                  "scoreBp": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "CARD",
                      "PAD",
                      "CHEQUE",
                      "WIRE",
                      "ETRANSFER",
                      "OTHER"
                    ]
                  },
                  "reference": {
                    "type": "string",
                    "maxLength": 60
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  }
                },
                "required": [
                  "scoreBp",
                  "method",
                  "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": {
                    "proposal": {
                      "$ref": "#/components/schemas/ProposalsItem"
                    },
                    "settlements": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "billId": {
                            "type": "string"
                          },
                          "settlementId": {
                            "type": "string"
                          },
                          "entryId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "postingMoved": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "billId",
                          "settlementId",
                          "entryId",
                          "postingMoved"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "proposal",
                    "settlements"
                  ],
                  "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/recon/scan": {
      "get": {
        "operationId": "latestReconScan",
        "summary": "Returns the latest reconciliation scan.",
        "description": "Returns the latest reconciliation scan. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "financialAccountId",
            "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": {
                  "type": "object",
                  "properties": {
                    "scan": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/ScanOption1"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "scan"
                  ],
                  "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": "scanForMatches",
        "summary": "Scans the bank lines for matches to the ledger.",
        "description": "Scans the bank lines for matches to the ledger. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "financialAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "windowDays": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 400
                  },
                  "amountToleranceMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  }
                },
                "required": [
                  "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": {
                  "type": "object",
                  "properties": {
                    "scan": {
                      "$ref": "#/components/schemas/ScanOption1"
                    },
                    "proposals": {
                      "$ref": "#/components/schemas/Proposals"
                    }
                  },
                  "required": [
                    "scan",
                    "proposals"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/recon/split-candidates": {
      "get": {
        "operationId": "listReconSplitCandidates",
        "summary": "Lists the bank lines that may split across several records.",
        "description": "Lists the bank lines that may split across several records. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "financialAccountId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "windowDays",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 400
            }
          }
        ],
        "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": {
                    "financialAccountId": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "windowFrom": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "windowTo": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "candidates": {
                      "$ref": "#/components/schemas/Candidates"
                    },
                    "truncated": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "financialAccountId",
                    "currency",
                    "windowFrom",
                    "windowTo",
                    "candidates",
                    "truncated"
                  ],
                  "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/recon/splits": {
      "post": {
        "operationId": "proposeReconSplit",
        "summary": "Proposes splitting a bank line across several records.",
        "description": "Proposes splitting a bank line across several records. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "financialAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "sourceTransactionId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "journalLineIds": {
                    "minItems": 1,
                    "maxItems": 12,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "remainderMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "remainderAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "remainderMemo": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "financialAccountId",
                  "sourceTransactionId",
                  "journalLineIds",
                  "remainderMinor",
                  "remainderAccountId",
                  "remainderMemo"
                ],
                "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": {
                  "type": "object",
                  "properties": {
                    "proposal": {
                      "$ref": "#/components/schemas/ProposalsItem"
                    },
                    "remainderEntryId": {
                      "type": "string"
                    },
                    "remainderMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "remainderAccountCode": {
                      "type": "string"
                    },
                    "remainderAccountName": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "proposal",
                    "remainderEntryId",
                    "remainderMinor",
                    "remainderAccountCode",
                    "remainderAccountName"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/record-imports": {
      "get": {
        "operationId": "listRecordImports",
        "summary": "Lists the record imports, with the server's total.",
        "description": "Lists the record imports, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Kind2"
            }
          },
          {
            "name": "objectKey",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "READING",
                "REVIEW",
                "APPLIED",
                "FAILED",
                "APPLYING",
                "REVERTED"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "uploadedFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "uploadedTo",
            "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"
                          },
                          "kind": {
                            "$ref": "#/components/schemas/Kind2"
                          },
                          "fileName": {
                            "type": "string"
                          },
                          "format": {
                            "type": "string",
                            "enum": [
                              "CSV",
                              "XLSX",
                              "IIF",
                              "PDF",
                              "IMAGE",
                              "XML",
                              "API"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "READING",
                              "REVIEW",
                              "APPLIED",
                              "FAILED",
                              "APPLYING",
                              "REVERTED"
                            ]
                          },
                          "counts": {
                            "$ref": "#/components/schemas/Counts3"
                          },
                          "documentId": {
                            "type": "string"
                          },
                          "uploadedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "createdAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "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"
                              }
                            ]
                          },
                          "failure": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sourceSystem": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "QUICKBOOKS_ONLINE",
                                  "QUICKBOOKS_DESKTOP",
                                  "XERO",
                                  "SAGE_50",
                                  "SPREADSHEET",
                                  "OTHER"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "sourceSystemLabel": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "apply": {
                            "default": null,
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "jobId": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "jobId"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "read": {
                            "default": null,
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "jobId": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "jobId"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "objectKey": {
                            "default": null,
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "fileName",
                          "format",
                          "status",
                          "counts",
                          "documentId",
                          "uploadedBy",
                          "createdAt",
                          "approvedBy",
                          "approvedAt",
                          "failure",
                          "apply",
                          "read",
                          "objectKey"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "entityTimeZone": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "entityTimeZone"
                  ],
                  "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/record-imports/{importId}": {
      "get": {
        "operationId": "getRecordImport",
        "summary": "Returns one record import with its rows and mapping.",
        "description": "Returns one record import with its rows and mapping. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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
            }
          },
          {
            "name": "filter",
            "in": "query",
            "required": false,
            "schema": {
              "default": "all",
              "type": "string",
              "enum": [
                "all",
                "problems",
                "low",
                "disagrees",
                "refused"
              ]
            }
          }
        ],
        "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/GetRecordImportResponse"
                }
              }
            }
          },
          "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/record-imports/{importId}/banking-checks": {
      "post": {
        "operationId": "requestBankingIntakeCheck",
        "summary": "Requests a check of the banking details a record import carries.",
        "description": "Requests a check of the banking details a record import carries. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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": {
          "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": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "importId": {
                      "type": "string"
                    },
                    "requestedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "requestedBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "rowsRequested": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "resultsSoFar": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "rowsQueued": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "id",
                    "importId",
                    "requestedAt",
                    "requestedBy",
                    "rowsRequested",
                    "resultsSoFar",
                    "rowsQueued"
                  ],
                  "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/record-imports/{importId}/banking-documents": {
      "get": {
        "operationId": "listBankingIntakeDocuments",
        "summary": "Lists the banking documents attached to a record import.",
        "description": "Lists the banking documents attached to a record import. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListBankingIntakeDocumentsResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "entityTimeZone"
                  ],
                  "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": "attachBankingIntakeDocument",
        "summary": "Attaches a banking document to a record import.",
        "description": "Attaches a banking document to a record import. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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": {
                  "documentId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "documentId"
                ],
                "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/ListBankingIntakeDocumentsResponseItem"
                }
              }
            }
          },
          "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/record-imports/{importId}/banking-documents/{attachmentId}/detach": {
      "post": {
        "operationId": "detachBankingIntakeDocument",
        "summary": "Detaches a banking document from a record import.",
        "description": "Detaches a banking document from a record import. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "importId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "attachmentId",
            "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/ListBankingIntakeDocumentsResponseItem"
                }
              }
            }
          },
          "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/record-imports/{importId}/fill": {
      "post": {
        "operationId": "fillRecordImportField",
        "summary": "Fills a missing field on every row of a record import.",
        "description": "Fills a missing field on every row of a record import. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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": {
                  "field": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "pattern": "^(?:[a-z][A-Za-z0-9]*|cf\\.[a-z][a-z0-9_]{0,39}|line\\.[a-z][a-z0-9_]{0,39})$"
                  },
                  "value": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "field",
                  "value"
                ],
                "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": {
                    "kind": {
                      "$ref": "#/components/schemas/Kind2"
                    },
                    "field": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "pattern": "^(?:[a-z][A-Za-z0-9]*|cf\\.[a-z][a-z0-9_]{0,39}|line\\.[a-z][a-z0-9_]{0,39})$"
                    },
                    "value": {
                      "type": "string"
                    },
                    "filled": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "counts": {
                      "$ref": "#/components/schemas/Counts3"
                    }
                  },
                  "required": [
                    "kind",
                    "field",
                    "value",
                    "filled",
                    "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/record-imports/{importId}/history-suppliers": {
      "get": {
        "operationId": "getRecordImportHistorySuppliers",
        "summary": "Lists the suppliers a record import's history refers to.",
        "description": "Lists the suppliers a record import's history refers to. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PLACED",
                "NOT_FOUND"
              ]
            }
          }
        ],
        "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": {
                          "nameKey": {
                            "type": "string"
                          },
                          "nameAsWritten": {
                            "type": "string"
                          },
                          "spellings": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "rows": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "PLACED_NAME",
                              "PLACED_ALIAS",
                              "NOT_FOUND"
                            ]
                          },
                          "vendor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  },
                                  "archived": {
                                    "type": "boolean"
                                  },
                                  "mergedInto": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "displayName": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "displayName"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName",
                                  "archived",
                                  "mergedInto"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "alias": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "nearby": {
                            "maxItems": 3,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "displayName": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "displayName"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "nameKey",
                          "nameAsWritten",
                          "spellings",
                          "rows",
                          "state",
                          "vendor",
                          "alias",
                          "nearby"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "PAID_BILL",
                        "VENDOR_PAYMENT"
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "names": {
                          "$ref": "#/components/schemas/Names"
                        },
                        "rows": {
                          "$ref": "#/components/schemas/Names"
                        }
                      },
                      "required": [
                        "names",
                        "rows"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "kind",
                    "counts"
                  ],
                  "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/record-imports/{importId}/mapping": {
      "put": {
        "operationId": "updateRecordImportMapping",
        "summary": "Changes the mapping from a file's columns to the ledger's fields.",
        "description": "Changes the mapping from a file's columns to the ledger's fields. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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": {
                  "columns": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "index": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 199
                        },
                        "field": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^(?:[a-z][A-Za-z0-9]*|cf\\.[a-z][a-z0-9_]{0,39}|line\\.[a-z][a-z0-9_]{0,39})$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "index",
                        "field"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "columns"
                ],
                "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/GetRecordImportResponse"
                }
              }
            }
          },
          "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/record-imports/{importId}/open-payables-position": {
      "get": {
        "operationId": "getOpenPayablesPosition",
        "summary": "Returns the open payables position an import found for the company.",
        "description": "Returns the open payables position an import found for the company. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "importId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "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": {
                    "importId": {
                      "type": "string"
                    },
                    "cutover": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "entityId": {
                          "type": "string"
                        },
                        "entityName": {
                          "type": "string"
                        },
                        "entityTimeZone": {
                          "type": "string"
                        },
                        "conversionDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "OPEN",
                            "SETTLED",
                            "WITHDRAWN"
                          ]
                        },
                        "previousSystem": {
                          "type": "string",
                          "enum": [
                            "QUICKBOOKS_ONLINE",
                            "QUICKBOOKS_DESKTOP",
                            "XERO",
                            "SAGE_50",
                            "SPREADSHEET",
                            "OTHER"
                          ]
                        },
                        "previousSystemLabel": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "itcClaimedInPreviousSystem": {
                          "type": "boolean"
                        },
                        "suspenseAccount": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "code",
                            "name"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "id",
                        "entityId",
                        "entityName",
                        "entityTimeZone",
                        "conversionDate",
                        "state",
                        "previousSystem",
                        "previousSystemLabel",
                        "itcClaimedInPreviousSystem",
                        "suspenseAccount"
                      ],
                      "additionalProperties": false
                    },
                    "rows": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "ready": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "notReady": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "total",
                        "ready",
                        "notReady"
                      ],
                      "additionalProperties": false
                    },
                    "bills": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "totals": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "minor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              }
                            },
                            "required": [
                              "currency",
                              "minor"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "functionalCurrency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "functionalTotalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "oldestBillDate": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "overdueAtConversion": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "functionalMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            }
                          },
                          "required": [
                            "count",
                            "functionalMinor"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "count",
                        "totals",
                        "functionalCurrency",
                        "functionalTotalMinor",
                        "oldestBillDate",
                        "overdueAtConversion"
                      ],
                      "additionalProperties": false
                    },
                    "notReady": {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "line": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "vendor": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "number": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "reason": {
                                "type": "string"
                              },
                              "candidates": {
                                "maxItems": 3,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "vendorId": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "vendorId",
                                    "name"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "line",
                              "vendor",
                              "number",
                              "reason",
                              "candidates"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "data",
                        "nextCursor",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "overAuthority": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "first": {
                          "maxItems": 5,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "line": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "vendor": {
                                "type": "string"
                              },
                              "number": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "line",
                              "vendor",
                              "number"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "holders": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "more": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "count",
                        "first",
                        "holders",
                        "more"
                      ],
                      "additionalProperties": false
                    },
                    "blockers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": [
                              "CUTOVER_CLOSED",
                              "NO_ROWS",
                              "ROWS_NOT_READY",
                              "UPLOADER",
                              "OVER_AUTHORITY",
                              "PERIOD_LOCKED",
                              "ALREADY_APPLIED"
                            ]
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "mayPost": {
                      "type": "boolean"
                    },
                    "posted": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "postedBy": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "postedAt": {
                              "type": "string",
                              "minLength": 20
                            },
                            "count": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "functionalTotalMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "controlTotalMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "differenceMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "controlNote": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "entryDate": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "firstEntryNumber": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "lastEntryNumber": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "postedBy",
                            "postedAt",
                            "count",
                            "functionalTotalMinor",
                            "controlTotalMinor",
                            "differenceMinor",
                            "controlNote",
                            "entryDate",
                            "firstEntryNumber",
                            "lastEntryNumber"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "importId",
                    "cutover",
                    "rows",
                    "bills",
                    "notReady",
                    "overAuthority",
                    "blockers",
                    "mayPost",
                    "posted"
                  ],
                  "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/record-imports/{importId}/prior-system": {
      "post": {
        "operationId": "declareRecordImportPriorSystem",
        "summary": "Declares which system a record import's figures came from.",
        "description": "Declares which system a record import's figures came from. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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": {
                  "recorded": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "recorded"
                ],
                "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/GetRecordImportResponse"
                }
              }
            }
          },
          "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/record-imports/{importId}/result": {
      "get": {
        "operationId": "getRecordImportResult",
        "summary": "Returns the result of a record import, with each row's outcome.",
        "description": "Returns the result of a record import, with each row's outcome. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 30
            }
          }
        ],
        "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": {
                          "recordId": {
                            "type": "string"
                          },
                          "firstLine": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "label": {
                            "type": "string"
                          },
                          "secondLine": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "state": {
                            "type": "string"
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "changedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "changedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "amount": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "minor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[A-Z]{3}$"
                                  }
                                },
                                "required": [
                                  "minor",
                                  "currency"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "recordId",
                          "firstLine",
                          "label",
                          "secondLine",
                          "state",
                          "note",
                          "changedAt",
                          "changedBy",
                          "amount"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "importId": {
                      "type": "string"
                    },
                    "kind": {
                      "$ref": "#/components/schemas/Kind2"
                    },
                    "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"
                        }
                      ]
                    },
                    "source": {
                      "type": "object",
                      "properties": {
                        "system": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "QUICKBOOKS_ONLINE",
                                "QUICKBOOKS_DESKTOP",
                                "XERO",
                                "SAGE_50",
                                "SPREADSHEET",
                                "OTHER"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "label": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "system",
                        "label"
                      ],
                      "additionalProperties": false
                    },
                    "recordCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "states": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "state": {
                            "type": "string"
                          },
                          "count": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "state",
                          "count"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "filter": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "state"
                      ],
                      "additionalProperties": false
                    },
                    "hiddenOutsideSeat": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "missing": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "importId",
                    "kind",
                    "approvedBy",
                    "approvedAt",
                    "source",
                    "recordCount",
                    "states",
                    "filter",
                    "hiddenOutsideSeat",
                    "missing",
                    "entityTimeZone"
                  ],
                  "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/record-imports/{importId}/rows/{rowId}": {
      "patch": {
        "operationId": "updateRecordImportRow",
        "summary": "Changes one row of a record import.",
        "description": "Changes one row of a record import. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "pattern": "^(?:[a-z][A-Za-z0-9]*|cf\\.[a-z][a-z0-9_]{0,39}|line\\.[a-z][a-z0-9_]{0,39})$"
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 500
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "cells"
                ],
                "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/RowsItem2"
                    },
                    "counts": {
                      "$ref": "#/components/schemas/Counts3"
                    }
                  },
                  "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/record-labels": {
      "get": {
        "operationId": "resolveRecordLabels",
        "summary": "Looks up the names behind up to 100 ids that custom fields point at, such as a customer, a vendor or a custom record.",
        "description": "Looks up the names behind up to 100 ids that custom fields point at, such as a customer, a vendor or a custom record. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "refs",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 20000
            }
          }
        ],
        "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": {
                    "labels": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "ref": {
                            "type": "string"
                          },
                          "label": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "archived": {
                            "type": "boolean"
                          },
                          "href": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "ref",
                          "label",
                          "archived",
                          "href"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "labels"
                  ],
                  "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/records-destruction-permissions": {
      "get": {
        "operationId": "listRecordsDestructionPermissions",
        "summary": "Lists the permissions to destroy records.",
        "description": "Lists the permissions to destroy records. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "live",
            "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/ListRecordsDestructionPermissionsResponseItem"
                      }
                    },
                    "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/records-destruction-permissions/{permissionId}/void": {
      "post": {
        "operationId": "voidRecordsDestructionPermission",
        "summary": "Voids a permission to destroy records.",
        "description": "Voids a permission to destroy records. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "permissionId",
            "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": 10,
                    "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/ListRecordsDestructionPermissionsResponseItem"
                }
              }
            }
          },
          "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/reference": {
      "get": {
        "operationId": "reference",
        "summary": "Returns the reference lists the ledger's pickers draw on.",
        "description": "Returns the reference lists the ledger's pickers draw on. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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": {
                    "gifi": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "section": {
                            "type": "string",
                            "enum": [
                              "ASSET",
                              "LIABILITY",
                              "EQUITY",
                              "REVENUE",
                              "EXPENSE"
                            ]
                          }
                        },
                        "required": [
                          "code",
                          "label",
                          "section"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "gifi"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "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/remittance-changes": {
      "get": {
        "operationId": "listRemittanceChanges",
        "summary": "Lists the changes to remittance profiles waiting for a decision.",
        "description": "Lists the changes to remittance profiles waiting for a decision. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BANK_DETAILS",
                "HOW_TO_PAY",
                "PAYMENT_LINK"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PROPOSED",
                "VERIFIED",
                "REJECTED",
                "WITHDRAWN",
                "EXPIRED"
              ]
            }
          },
          {
            "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/ListRemittanceChangesResponseItem"
                      }
                    },
                    "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/remittance-changes/{changeId}/reject": {
      "post": {
        "operationId": "rejectRemittanceChange",
        "summary": "Rejects a proposed change to a remittance profile.",
        "description": "Rejects a proposed change to a remittance profile. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "changeId",
            "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/ListRemittanceChangesResponseItem"
                }
              }
            }
          },
          "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/remittance-changes/{changeId}/withdraw": {
      "post": {
        "operationId": "withdrawRemittanceChange",
        "summary": "Withdraws a proposed change to a remittance profile.",
        "description": "Withdraws a proposed change to a remittance profile. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "changeId",
            "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/ListRemittanceChangesResponseItem"
                }
              }
            }
          },
          "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/remittance-profiles": {
      "get": {
        "operationId": "listRemittanceProfiles",
        "summary": "Lists the remittance profiles that say where customers pay.",
        "description": "Lists the remittance profiles that say where customers pay. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "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": {
                    "profiles": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "beneficiaryName": {
                            "type": "string"
                          },
                          "beneficiaryAddress": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "institutionName": {
                            "type": "string"
                          },
                          "accountLast4": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 4
                          },
                          "swiftBic": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "intermediaryName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "intermediarySwiftBic": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "verifiedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "verifiedAt": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "entityName",
                          "currency",
                          "beneficiaryName",
                          "beneficiaryAddress",
                          "institutionName",
                          "accountLast4",
                          "swiftBic",
                          "intermediaryName",
                          "intermediarySwiftBic",
                          "verifiedBy",
                          "verifiedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "texts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "howToPay": {
                            "type": "object",
                            "properties": {
                              "en": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "fr": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "en",
                              "fr"
                            ],
                            "additionalProperties": false
                          },
                          "paymentLinkTemplate": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "terms": {
                            "type": "object",
                            "properties": {
                              "en": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "fr": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "en",
                              "fr"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "entityId",
                          "howToPay",
                          "paymentLinkTemplate",
                          "terms"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "profiles",
                    "texts"
                  ],
                  "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/rules": {
      "get": {
        "operationId": "listRules",
        "summary": "Lists the rules that route, approve or post documents.",
        "description": "Lists the rules that route, approve or post documents. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PROPOSED",
                "ACTIVE",
                "DISCARDED",
                "RETIRED"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ROUTING",
                "CODING",
                "AUTO_APPROVAL",
                "HOLD",
                "MATCH_TOLERANCE",
                "LINE_PROFILE",
                "RUN_PREPARE"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "subject",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ENTRY",
                "BILL",
                "VENDOR",
                "RUN",
                "INVOICE"
              ]
            }
          },
          {
            "name": "vendorId",
            "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": {
                        "$ref": "#/components/schemas/ListRulesResponseItem"
                      }
                    },
                    "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": "createRule",
        "summary": "Creates a rule that routes, approves or posts documents.",
        "description": "Creates a rule that routes, approves or posts documents. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sourceText": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 400
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "ROUTING",
                      "CODING",
                      "AUTO_APPROVAL",
                      "HOLD",
                      "MATCH_TOLERANCE",
                      "LINE_PROFILE",
                      "RUN_PREPARE"
                    ]
                  },
                  "entityId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "rule": {
                    "$ref": "#/components/schemas/RuleOption1"
                  },
                  "subject": {
                    "default": "ENTRY",
                    "type": "string",
                    "enum": [
                      "ENTRY",
                      "BILL",
                      "VENDOR",
                      "RUN",
                      "INVOICE"
                    ]
                  },
                  "expiresOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "draft": {
                    "type": "object",
                    "properties": {
                      "source": {
                        "type": "string",
                        "enum": [
                          "PARSER",
                          "MODEL",
                          "PERSON"
                        ]
                      },
                      "promptVersion": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 40
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "fieldsChanged": {
                        "maxItems": 12,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "maxLength": 40
                        }
                      }
                    },
                    "required": [
                      "source",
                      "promptVersion",
                      "fieldsChanged"
                    ],
                    "additionalProperties": false
                  },
                  "replacesRuleId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "sourceText",
                  "kind",
                  "rule"
                ],
                "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/ListRulesResponseItem"
                }
              }
            }
          },
          "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/rules/firings": {
      "get": {
        "operationId": "listRuleFirings",
        "summary": "Lists the times the rules fired, newest first.",
        "description": "Lists the times the rules fired, newest first. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "ruleId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ROUTED",
                "SHAPED",
                "AUTO_APPROVED",
                "NOT_APPLIED",
                "WITHIN_AUTHORITY",
                "REFUSED",
                "HELD",
                "TOLERATED",
                "PREPARED"
              ]
            }
          },
          {
            "name": "entryId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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}$"
            }
          },
          {
            "name": "billId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "paymentRunId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "authorityId",
            "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": {
                          "id": {
                            "type": "string"
                          },
                          "ruleId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "ruleSourceText": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "ruleVersion": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "outcome": {
                            "type": "string",
                            "enum": [
                              "ROUTED",
                              "SHAPED",
                              "AUTO_APPROVED",
                              "NOT_APPLIED",
                              "WITHIN_AUTHORITY",
                              "REFUSED",
                              "HELD",
                              "TOLERATED",
                              "PREPARED"
                            ]
                          },
                          "entryId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entryRef": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entryDate": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "amountMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "currency": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "tier": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "BOOKKEEPER",
                                  "SENIOR",
                                  "CONTROLLER"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "reason": {
                            "type": "string"
                          },
                          "firedAt": {
                            "type": "string"
                          },
                          "subject": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "ENTRY",
                                  "BILL",
                                  "VENDOR",
                                  "RUN",
                                  "INVOICE",
                                  "ORDER",
                                  "NONE"
                                ]
                              },
                              "id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "ref": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "kind",
                              "id",
                              "ref"
                            ],
                            "additionalProperties": false
                          },
                          "authorityId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "measuredMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "measuredCurrency": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "firedByName": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "ruleId",
                          "ruleSourceText",
                          "ruleVersion",
                          "outcome",
                          "entryId",
                          "entryRef",
                          "entryDate",
                          "amountMinor",
                          "currency",
                          "tier",
                          "reason",
                          "firedAt",
                          "subject",
                          "authorityId",
                          "measuredMinor",
                          "measuredCurrency",
                          "firedByName"
                        ],
                        "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/rules/preview": {
      "post": {
        "operationId": "previewRule",
        "summary": "Previews what a rule would do to recent documents before it is saved.",
        "description": "Previews what a rule would do to recent documents before it is saved. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ruleId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "ruleId"
                ],
                "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/PreviewRuleResponse"
                }
              }
            }
          },
          "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/rules/routing": {
      "get": {
        "operationId": "routingDecisions",
        "summary": "Lists the routing decisions the rules made.",
        "description": "Lists the routing decisions the rules made. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entryIds",
            "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": {
                  "type": "object",
                  "properties": {
                    "decisions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entryId": {
                            "type": "string"
                          },
                          "tier": {
                            "type": "string",
                            "enum": [
                              "BOOKKEEPER",
                              "SENIOR",
                              "CONTROLLER"
                            ]
                          },
                          "reason": {
                            "type": "string"
                          },
                          "ruleId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "ruleSourceText": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "pinned": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "entryId",
                          "tier",
                          "reason",
                          "ruleId",
                          "ruleSourceText",
                          "pinned"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "decisions"
                  ],
                  "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/rules/{ruleId}": {
      "get": {
        "operationId": "getRule",
        "summary": "Returns one rule with its conditions and status.",
        "description": "Returns one rule with its conditions and status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "ruleId",
            "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/ListRulesResponseItem"
                }
              }
            }
          },
          "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/rules/{ruleId}/decide": {
      "post": {
        "operationId": "decideRule",
        "summary": "Approves or declines a proposed rule.",
        "description": "Approves or declines a proposed rule. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "ruleId",
            "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": [
                      "CONFIRM",
                      "DISCARD"
                    ]
                  },
                  "sourceText": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 400
                  },
                  "rule": {
                    "$ref": "#/components/schemas/RuleOption1"
                  },
                  "entityId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "subject": {
                    "type": "string",
                    "enum": [
                      "ENTRY",
                      "BILL",
                      "VENDOR",
                      "RUN",
                      "INVOICE"
                    ]
                  },
                  "expiresAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "previewId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "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/ListRulesResponseItem"
                }
              }
            }
          },
          "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/rules/{ruleId}/status": {
      "post": {
        "operationId": "setRuleStatus",
        "summary": "Switches a rule on or off.",
        "description": "Switches a rule on or off. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "ruleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "ACTIVE",
                      "RETIRED"
                    ]
                  }
                },
                "required": [
                  "status"
                ],
                "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/ListRulesResponseItem"
                }
              }
            }
          },
          "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/run-policies/draft": {
      "post": {
        "operationId": "draftRunPolicy",
        "summary": "Drafts a policy that prepares payment runs on a schedule.",
        "description": "Drafts a policy that prepares payment runs on a schedule. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:admin",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sentence": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 400
                  },
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "sentence",
                  "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"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "drafted": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "rule": {
                              "type": "object",
                              "properties": {
                                "when": {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {
                                    "$ref": "#/components/schemas/DraftRunPolicyResponsePart1"
                                  }
                                },
                                "then": {
                                  "$ref": "#/components/schemas/ThenOption7"
                                }
                              },
                              "required": [
                                "when",
                                "then"
                              ],
                              "additionalProperties": false
                            },
                            "sentence": {
                              "type": "string"
                            },
                            "expiresOn": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "rule",
                            "sentence",
                            "expiresOn"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "MODEL_FAILED",
                            "REFUSED",
                            "UNPARSABLE",
                            "NOT_IN_SENTENCE",
                            "NOT_FROM_LIST"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "source": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "PARSER",
                            "MODEL"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "promptVersion": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "drafted",
                    "why",
                    "source",
                    "promptVersion"
                  ],
                  "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/run-policies/firings/{firingId}/lines": {
      "get": {
        "operationId": "listRunPolicyLines",
        "summary": "Lists the lines a payment run policy firing produced.",
        "description": "Lists the lines a payment run policy firing produced. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "firingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "decision",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "TAKEN",
                "SKIPPED"
              ]
            }
          },
          {
            "name": "reason",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/SkipReasonOption1"
            }
          },
          {
            "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/LinesItem2"
                      }
                    },
                    "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/run-policies/{ruleId}/declines": {
      "get": {
        "operationId": "listRunPolicyDeclines",
        "summary": "Lists the times a payment run policy declined to run.",
        "description": "Lists the times a payment run policy declined to run. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "ruleId",
            "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"
                          },
                          "ruleId": {
                            "type": "string"
                          },
                          "ruleVersion": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "paymentRunId": {
                            "type": "string"
                          },
                          "runLabel": {
                            "type": "string"
                          },
                          "paymentId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "TOO_MUCH",
                              "TOO_EARLY",
                              "WRONG_SUPPLIER",
                              "OTHER"
                            ]
                          },
                          "note": {
                            "type": "string"
                          },
                          "suggestion": {
                            "anyOf": [
                              {
                                "$ref": "#/components/schemas/Suggestion"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "suggestionState": {
                            "type": "string",
                            "enum": [
                              "OPEN",
                              "TAKEN_UP",
                              "SUPERSEDED",
                              "ENDED"
                            ]
                          },
                          "declinedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "declinedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "entityTimeZone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "ruleId",
                          "ruleVersion",
                          "paymentRunId",
                          "runLabel",
                          "paymentId",
                          "kind",
                          "note",
                          "suggestion",
                          "suggestionState",
                          "declinedBy",
                          "declinedAt",
                          "entityTimeZone"
                        ],
                        "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/run-policies/{ruleId}/prepare-now": {
      "post": {
        "operationId": "prepareRunPolicyNow",
        "summary": "Asks the payment policy to prepare a run now; the pass runs a moment later under the policy.",
        "description": "Asks the payment policy to prepare a run now; the pass runs a moment later under the policy. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "ruleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "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": {
                    "ruleId": {
                      "type": "string"
                    },
                    "ruleVersion": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "weekStart": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "askedAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "ruleId",
                    "ruleVersion",
                    "weekStart",
                    "askedAt"
                  ],
                  "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/run/fx/request": {
      "post": {
        "operationId": "requestFxRefresh",
        "summary": "Asks for the exchange rates to be refreshed from the rate source, and answers at once; the rates follow within moments.",
        "description": "Asks for the exchange rates to be refreshed from the rate source, and answers at once; the rates follow within moments. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "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": {
                    "queued": {
                      "type": "boolean",
                      "const": true
                    },
                    "asOf": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "daysBack": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 30
                    }
                  },
                  "required": [
                    "queued",
                    "asOf",
                    "daysBack"
                  ],
                  "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"
          }
        }
      }
    },
    "/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/schedules": {
      "get": {
        "operationId": "listSchedules",
        "summary": "Lists the recurring schedules that post or raise bills on a set cadence.",
        "description": "Lists the recurring schedules that post or raise bills on a set cadence. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "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
            }
          },
          {
            "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": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListSchedulesResponseItem"
                      }
                    },
                    "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
                }
              }
            }
          },
          "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/schedules/active": {
      "post": {
        "operationId": "setScheduleActive",
        "summary": "Pauses or resumes a recurring schedule.",
        "description": "Pauses or resumes a recurring schedule. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "scheduleId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "active": {
                    "type": "boolean"
                  },
                  "restoreNextRunDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "scheduleId",
                  "active"
                ],
                "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": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/schedules/follow-bill": {
      "post": {
        "operationId": "followScheduleBill",
        "summary": "Makes a recurring schedule follow a bill.",
        "description": "Makes a recurring schedule follow a bill. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "scheduleId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "billId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "signalId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "scheduleId",
                  "billId"
                ],
                "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": {
                    "scheduleId": {
                      "type": "string"
                    },
                    "billId": {
                      "type": "string"
                    },
                    "number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "subtotalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "lineCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "confirmedSignalId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "scheduleId",
                    "billId",
                    "number",
                    "subtotalMinor",
                    "lineCount",
                    "confirmedSignalId"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/schedules/promote": {
      "post": {
        "operationId": "promoteToSchedule",
        "summary": "Turns a bill or entry into a recurring schedule.",
        "description": "Turns a bill or entry into a recurring schedule. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entryId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "frequency": {
                    "type": "string",
                    "enum": [
                      "WEEKLY",
                      "BIWEEKLY",
                      "MONTHLY",
                      "QUARTERLY",
                      "ANNUAL"
                    ]
                  },
                  "startDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "endDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "autoReverse": {
                    "default": false,
                    "type": "boolean"
                  },
                  "reversalOffsetDays": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 90
                  }
                },
                "required": [
                  "entryId",
                  "name",
                  "frequency",
                  "startDate"
                ],
                "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/ListSchedulesResponseItem"
                }
              }
            }
          },
          "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/schedules/repeat-bill": {
      "post": {
        "operationId": "repeatBill",
        "summary": "Makes a recurring schedule from a posted bill, so the bill is raised again each period.",
        "description": "Makes a recurring schedule from a posted bill, so the bill is raised again each period. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "accounting"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "billId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "frequency": {
                    "type": "string",
                    "enum": [
                      "WEEKLY",
                      "BIWEEKLY",
                      "MONTHLY",
                      "QUARTERLY",
                      "ANNUAL"
                    ]
                  },
                  "startDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "endDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "billId",
                  "name",
                  "frequency",
                  "startDate"
                ],
                "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/ListSchedulesResponseItem"
                }
              }
            }
          },
          "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/sender-domains": {
      "get": {
        "operationId": "getSenderDomain",
        "summary": "Returns the sending domain the ledger sends email from.",
        "description": "Returns the sending domain the ledger sends email from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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/GetSenderDomainResponse"
                }
              }
            }
          },
          "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": "createSenderDomain",
        "summary": "Adds a sending domain the ledger sends email from.",
        "description": "Adds a sending domain the ledger sends email from. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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
                  },
                  "address": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 200
                  }
                },
                "required": [
                  "entityId",
                  "address"
                ],
                "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/GetSenderDomainResponse"
                }
              }
            }
          },
          "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/sender-domains/check": {
      "post": {
        "operationId": "checkSenderDomain",
        "summary": "Checks the DNS records of a sending domain.",
        "description": "Checks the DNS records of a sending domain. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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
                  }
                },
                "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/GetSenderDomainResponse"
                }
              }
            }
          },
          "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/sender-domains/remove": {
      "post": {
        "operationId": "removeSenderDomain",
        "summary": "Removes a sending domain.",
        "description": "Removes a sending domain. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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
                  }
                },
                "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/GetSenderDomainResponse"
                }
              }
            }
          },
          "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/sending": {
      "get": {
        "operationId": "getSendingSettings",
        "summary": "Returns the settings the ledger sends email with.",
        "description": "Returns the settings the ledger sends email with. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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/GetSendingSettingsResponse"
                }
              }
            }
          },
          "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": "updateSendingSettings",
        "summary": "Changes the settings the ledger sends email with.",
        "description": "Changes the settings the ledger sends email with. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "documents"
        ],
        "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
                  },
                  "replyToEmail": {
                    "anyOf": [
                      {
                        "type": "string",
                        "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,}$"
                      },
                      {
                        "type": "string",
                        "const": ""
                      }
                    ]
                  },
                  "paymentInstructions": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 1000
                      },
                      {
                        "type": "string",
                        "const": ""
                      }
                    ]
                  },
                  "template": {
                    "$ref": "#/components/schemas/Template"
                  },
                  "documentLabels": {
                    "$ref": "#/components/schemas/DocumentLabels"
                  },
                  "paymentLink": {
                    "type": "string",
                    "maxLength": 2000
                  }
                },
                "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/GetSendingSettingsResponse"
                }
              }
            }
          },
          "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/settlement-registrations": {
      "get": {
        "operationId": "listSettlementRegistrations",
        "summary": "Lists the accounts that receive settlements, and how each is registered.",
        "description": "Lists the accounts that receive settlements, and how each is registered. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "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": {
                        "$ref": "#/components/schemas/ListSettlementRegistrationsResponseItem"
                      }
                    },
                    "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/settlement-registrations/{financialAccountId}/nominations": {
      "post": {
        "operationId": "nominateSettlementAccounts",
        "summary": "Nominates the accounts a settlement is paid into.",
        "description": "Nominates the accounts a settlement is paid into. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "financialAccountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "clearingAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "feeAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "revenueAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "bankAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "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/ListSettlementRegistrationsResponseItem"
                }
              }
            }
          },
          "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/settlements": {
      "get": {
        "operationId": "listSettlements",
        "summary": "Lists the settlements from payment processors, with the server's total.",
        "description": "Lists the settlements from payment processors, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "processor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "STRIPE",
                "SHOPIFY",
                "LIGHTSPEED"
              ]
            }
          },
          {
            "name": "clearing",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "zeroed",
                "open"
              ]
            }
          },
          {
            "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": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "processor": {
                            "type": "string",
                            "enum": [
                              "STRIPE",
                              "SHOPIFY",
                              "LIGHTSPEED"
                            ]
                          },
                          "externalId": {
                            "type": "string"
                          },
                          "payoutDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "grossMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "feeMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "netMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "connectionName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "clearing": {
                            "$ref": "#/components/schemas/Clearing"
                          },
                          "deepLink": {
                            "type": "string",
                            "format": "uri"
                          }
                        },
                        "required": [
                          "id",
                          "processor",
                          "externalId",
                          "payoutDate",
                          "currency",
                          "grossMinor",
                          "feeMinor",
                          "netMinor",
                          "entityId",
                          "entityName",
                          "clearing",
                          "deepLink"
                        ],
                        "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/settlements/assemble": {
      "post": {
        "operationId": "assembleSettlements",
        "summary": "Assembles settlements from the payouts a processor made.",
        "description": "Assembles settlements from the payouts a processor made. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "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": {
                  "type": "object",
                  "properties": {
                    "batchesCreated": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "componentsCreated": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "incompleteGroups": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "remaining": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "stalled": {
                      "type": "boolean"
                    },
                    "failures": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "payoutId": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string",
                            "enum": [
                              "SETTLED_BY_STATEMENTS",
                              "COMPONENTS_MISSING",
                              "MIXED_ACCOUNTS",
                              "ACCOUNT_UNKNOWN",
                              "MIXED_CURRENCIES",
                              "BOOKED_AS_BANK_LINES",
                              "STAGED_AFTER_ASSEMBLY",
                              "ASSEMBLED_CONCURRENTLY"
                            ]
                          },
                          "payoutMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "stagedMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "currency": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "stagedComponentIds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "message": {
                            "type": "string"
                          },
                          "remedy": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "payoutId",
                          "reason",
                          "payoutMinor",
                          "stagedMinor",
                          "currency",
                          "stagedComponentIds",
                          "message",
                          "remedy"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "batchesCreated",
                    "componentsCreated",
                    "incompleteGroups",
                    "remaining",
                    "stalled"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/settlements/{settlementId}": {
      "get": {
        "operationId": "getSettlement",
        "summary": "Returns one settlement with the sales and fees it covers.",
        "description": "Returns one settlement with the sales and fees it covers. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "settlementId",
            "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": {
                    "id": {
                      "type": "string"
                    },
                    "processor": {
                      "type": "string",
                      "enum": [
                        "STRIPE",
                        "SHOPIFY",
                        "LIGHTSPEED"
                      ]
                    },
                    "externalId": {
                      "type": "string"
                    },
                    "payoutDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "grossMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "feeMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "netMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "connectionName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "clearing": {
                      "$ref": "#/components/schemas/Clearing"
                    },
                    "deepLink": {
                      "type": "string",
                      "format": "uri"
                    },
                    "clearingAccount": {
                      "$ref": "#/components/schemas/Account"
                    },
                    "components": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "CHARGE",
                              "REFUND",
                              "FEE",
                              "DISPUTE",
                              "ADJUSTMENT",
                              "PAYOUT"
                            ]
                          },
                          "externalId": {
                            "type": "string"
                          },
                          "occurredAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "feeMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "feeTax": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "EXEMPT_PROCESSING",
                                  "TAXABLE_SAAS",
                                  "TAX_ON_FEES"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "taxAmountMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "entryId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entryNumber": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "entryStatus": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "journalLineId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "deepLink": {
                            "type": "string",
                            "format": "uri"
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "externalId",
                          "occurredAt",
                          "amountMinor",
                          "feeMinor",
                          "currency",
                          "feeTax",
                          "taxAmountMinor",
                          "entryId",
                          "entryNumber",
                          "entryStatus",
                          "journalLineId",
                          "deepLink"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "componentsNextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "undraftedAdjustments": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "id",
                    "processor",
                    "externalId",
                    "payoutDate",
                    "currency",
                    "grossMinor",
                    "feeMinor",
                    "netMinor",
                    "entityId",
                    "entityName",
                    "clearing",
                    "deepLink",
                    "clearingAccount",
                    "components",
                    "componentsNextCursor",
                    "undraftedAdjustments"
                  ],
                  "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/settlements/{settlementId}/propose": {
      "post": {
        "operationId": "proposeSettlement",
        "summary": "Proposes how a settlement should be posted, for a person to decide.",
        "description": "Proposes how a settlement should be posted, for a person to decide. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "settlementId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "holdingAccountId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "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"
          },
          "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/signals": {
      "get": {
        "operationId": "listSignals",
        "summary": "Lists the signals the ledger raised for a person to act on, with the server's total.",
        "description": "Lists the signals the ledger raised for a person to act on, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "One or more of DUPLICATE_BILL, HOLDER_NAME_MISMATCH, NO_EVIDENCE, NEW_SENDER_DOMAIN, FIRST_TIME_SENDER_DOMAIN, CHANGE_BEFORE_A_LARGE_BILL, SHORT_INTERVAL, SHARED_ACCOUNT, PRINTED_ACCOUNT_DIFFERS, DOCUMENT_EXPIRING, AGREEMENT_RENEWING, SLIP_IDENTITY_INCOMPLETE, SLIP_KIND_QUESTIONED, EXPECTED_BILL_MISSING, RECURRING_AMOUNT_MOVED, TAX_TREATMENT_DRIFT, PRICE_CREEP, CAPITAL_PURCHASE, separated by commas.",
            "schema": {
              "type": "string",
              "description": "One or more of DUPLICATE_BILL, HOLDER_NAME_MISMATCH, NO_EVIDENCE, NEW_SENDER_DOMAIN, FIRST_TIME_SENDER_DOMAIN, CHANGE_BEFORE_A_LARGE_BILL, SHORT_INTERVAL, SHARED_ACCOUNT, PRINTED_ACCOUNT_DIFFERS, DOCUMENT_EXPIRING, AGREEMENT_RENEWING, SLIP_IDENTITY_INCOMPLETE, SLIP_KIND_QUESTIONED, EXPECTED_BILL_MISSING, RECURRING_AMOUNT_MOVED, TAX_TREATMENT_DRIFT, PRICE_CREEP, CAPITAL_PURCHASE, separated by commas."
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "One or more of OPEN, DISMISSED, CONFIRMED, separated by commas.",
            "schema": {
              "type": "string",
              "description": "One or more of OPEN, DISMISSED, CONFIRMED, separated by commas."
            }
          },
          {
            "name": "severity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "CRITICAL",
                "WARNING",
                "INFO"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "billId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "documentId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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}$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "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"
                          },
                          "kind": {
                            "$ref": "#/components/schemas/Kind4"
                          },
                          "severity": {
                            "type": "string",
                            "enum": [
                              "CRITICAL",
                              "WARNING",
                              "INFO"
                            ]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "OPEN",
                              "DISMISSED",
                              "CONFIRMED"
                            ]
                          },
                          "sentence": {
                            "type": "string"
                          },
                          "subject": {
                            "$ref": "#/components/schemas/Subject"
                          },
                          "vendor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "entityId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entityName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "observedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "raisedBy": {
                            "type": "string"
                          },
                          "raisedFor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "priorsExamined": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "decision": {
                            "$ref": "#/components/schemas/Decision"
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "severity",
                          "state",
                          "sentence",
                          "subject",
                          "vendor",
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "observedAt",
                          "raisedBy",
                          "raisedFor",
                          "priorsExamined",
                          "decision"
                        ],
                        "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/signals/{signalId}": {
      "get": {
        "operationId": "getSignal",
        "summary": "Returns one signal with the evidence it was raised on.",
        "description": "Returns one signal with the evidence it was raised on. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "signalId",
            "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/GetSignalResponse"
                }
              }
            }
          },
          "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/signals/{signalId}/confirm": {
      "post": {
        "operationId": "confirmSignal",
        "summary": "Confirms a signal so the action it proposes is taken.",
        "description": "Confirms a signal so the action it proposes is taken. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "signalId",
            "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/GetSignalResponse"
                }
              }
            }
          },
          "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/signals/{signalId}/dismiss": {
      "post": {
        "operationId": "dismissSignal",
        "summary": "Dismisses a signal with a reason.",
        "description": "Dismisses a signal with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "signalId",
            "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": 4,
                    "maxLength": 500
                  },
                  "scope": {
                    "type": "string",
                    "enum": [
                      "THIS_MONTH",
                      "SUPPLIER_FOR_A_YEAR"
                    ]
                  }
                },
                "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/GetSignalResponse"
                }
              }
            }
          },
          "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/slips/copies/{copyId}": {
      "get": {
        "operationId": "getSlipCopy",
        "summary": "Returns one copy of a slip file.",
        "description": "Returns one copy of a slip file. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "copyId",
            "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"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "NOT_PRODUCED",
                        "PRODUCED",
                        "DRAFTED",
                        "BOUNCED",
                        "EMAILED",
                        "POSTED"
                      ]
                    },
                    "language": {
                      "type": "string",
                      "enum": [
                        "en",
                        "fr",
                        "bilingual"
                      ]
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "T4A",
                        "T5018"
                      ]
                    },
                    "taxYear": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "reportTypeCode": {
                      "type": "string",
                      "enum": [
                        "O",
                        "A"
                      ]
                    },
                    "file": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "fileName": {
                          "type": "string"
                        },
                        "producedOn": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        }
                      },
                      "required": [
                        "id",
                        "fileName",
                        "producedOn"
                      ],
                      "additionalProperties": false
                    },
                    "entity": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "vendor": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "displayName"
                      ],
                      "additionalProperties": false
                    },
                    "recipientType": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "INDIVIDUAL",
                            "CORPORATION",
                            "PARTNERSHIP"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "producedBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "producedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "documentSha256": {
                      "type": "string",
                      "minLength": 64,
                      "maxLength": 64
                    },
                    "boxes": {
                      "minItems": 1,
                      "maxItems": 2,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "box": {
                            "type": "string"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "box",
                          "amountMinor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "recipient": {
                      "type": "object",
                      "properties": {
                        "nameLines": {
                          "minItems": 1,
                          "maxItems": 3,
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "addressLines": {
                          "maxItems": 4,
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "sinHeld": {
                          "type": "boolean"
                        },
                        "programAccount": {
                          "type": "string",
                          "minLength": 15,
                          "maxLength": 15
                        }
                      },
                      "required": [
                        "nameLines",
                        "addressLines",
                        "sinHeld",
                        "programAccount"
                      ],
                      "additionalProperties": false
                    },
                    "posted": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "on": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "by": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "recordedAt": {
                              "type": "string",
                              "minLength": 20
                            },
                            "note": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "on",
                            "by",
                            "recordedAt",
                            "note"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "deliveries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "notice": {
                            "$ref": "#/components/schemas/ListVendorNoticesResponseItem"
                          },
                          "consent": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "basis": {
                                    "type": "string",
                                    "enum": [
                                      "WRITTEN",
                                      "ELECTRONIC"
                                    ]
                                  },
                                  "givenOn": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "recordedBy": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "recordedAt": {
                                    "type": "string",
                                    "minLength": 20
                                  }
                                },
                                "required": [
                                  "basis",
                                  "givenOn",
                                  "recordedBy",
                                  "recordedAt"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "notice",
                          "consent"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "email": {
                      "$ref": "#/components/schemas/Email2"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "reference",
                    "state",
                    "language",
                    "kind",
                    "taxYear",
                    "reportTypeCode",
                    "file",
                    "entity",
                    "vendor",
                    "recipientType",
                    "producedBy",
                    "producedAt",
                    "documentSha256",
                    "boxes",
                    "recipient",
                    "posted",
                    "deliveries",
                    "email",
                    "entityTimeZone"
                  ],
                  "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/slips/files": {
      "get": {
        "operationId": "listSlipFiles",
        "summary": "Lists the slip files produced, with the server's total.",
        "description": "Lists the slip files produced, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "T4A",
                "T5018"
              ]
            }
          },
          {
            "name": "periodEnd",
            "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
            }
          },
          {
            "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": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "T4A",
                              "T5018"
                            ]
                          },
                          "periodEnd": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "taxYear": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "slipCount": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "totalMinor": {
                            "type": "string"
                          },
                          "sha256": {
                            "type": "string"
                          },
                          "fileName": {
                            "type": "string"
                          },
                          "producedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "producedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "amends": {
                            "$ref": "#/components/schemas/LatestFile"
                          },
                          "recipientsKept": {
                            "type": "boolean"
                          },
                          "copies": {
                            "type": "object",
                            "properties": {
                              "produced": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "delivered": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "total": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "produced",
                              "delivered",
                              "total"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "periodEnd",
                          "taxYear",
                          "slipCount",
                          "totalMinor",
                          "sha256",
                          "fileName",
                          "producedBy",
                          "producedAt",
                          "amends",
                          "recipientsKept",
                          "copies"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "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
                }
              }
            }
          },
          "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/slips/files/{fileId}/copies": {
      "get": {
        "operationId": "listSlipCopies",
        "summary": "Lists the copies of a slip file, with the server's total.",
        "description": "Lists the copies of a slip file, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "fileId",
            "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
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "One or more of NOT_PRODUCED, PRODUCED, DRAFTED, BOUNCED, EMAILED, POSTED, separated by commas.",
            "schema": {
              "type": "string",
              "description": "One or more of NOT_PRODUCED, PRODUCED, DRAFTED, BOUNCED, EMAILED, POSTED, separated by commas."
            }
          },
          {
            "name": "needs",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "EMAIL",
                "PAPER"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "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": {
                          "recipientId": {
                            "type": "string"
                          },
                          "position": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "recipientType": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "INDIVIDUAL",
                                  "CORPORATION",
                                  "PARTNERSHIP"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "boxMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "copy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "reference": {
                                    "type": "string"
                                  },
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "NOT_PRODUCED",
                                      "PRODUCED",
                                      "DRAFTED",
                                      "BOUNCED",
                                      "EMAILED",
                                      "POSTED"
                                    ]
                                  },
                                  "language": {
                                    "type": "string",
                                    "enum": [
                                      "en",
                                      "fr",
                                      "bilingual"
                                    ]
                                  },
                                  "producedBy": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "producedAt": {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  "mailedOn": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "mailedBy": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "name"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "documentSha256": {
                                    "type": "string",
                                    "minLength": 64,
                                    "maxLength": 64
                                  }
                                },
                                "required": [
                                  "id",
                                  "reference",
                                  "state",
                                  "language",
                                  "producedBy",
                                  "producedAt",
                                  "mailedOn",
                                  "mailedBy",
                                  "documentSha256"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "email": {
                            "$ref": "#/components/schemas/Email2"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "recipientId",
                          "position",
                          "vendor",
                          "recipientType",
                          "boxMinor",
                          "copy",
                          "email",
                          "entityTimeZone"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "file": {
                      "$ref": "#/components/schemas/LatestFileOption1"
                    },
                    "required": {
                      "type": "boolean"
                    },
                    "outboundApproved": {
                      "type": "boolean"
                    },
                    "emailPreview": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "subject": {
                              "type": "string"
                            },
                            "text": {
                              "type": "string"
                            },
                            "replyTo": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "name": {
                                      "type": "string"
                                    },
                                    "telephone": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "telephone"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "subject",
                            "text",
                            "replyTo"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "notProduced": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "produced": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "drafted": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "emailed": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "bounced": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "posted": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "needsEmail": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "needsPaper": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "documentsUnstored": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "total",
                        "notProduced",
                        "produced",
                        "drafted",
                        "emailed",
                        "bounced",
                        "posted",
                        "needsEmail",
                        "needsPaper",
                        "documentsUnstored"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "file",
                    "required",
                    "outboundApproved",
                    "emailPreview",
                    "counts"
                  ],
                  "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": "produceSlipCopies",
        "summary": "Produces the copies of a slip file for the recipients.",
        "description": "Produces the copies of a slip file for the recipients. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "limit": {
                    "default": 100,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  }
                },
                "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": {
                  "type": "object",
                  "properties": {
                    "produced": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "remaining": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "alreadyProduced": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "produced",
                    "remaining",
                    "alreadyProduced"
                  ],
                  "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/slips/files/{fileId}/copies/mailed": {
      "post": {
        "operationId": "recordSlipCopiesMailed",
        "summary": "Records that copies of a slip file were mailed.",
        "description": "Records that copies of a slip file were mailed. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "copyIds": {
                        "minItems": 1,
                        "maxItems": 200,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "mailedOn": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "note": {
                        "type": "string",
                        "maxLength": 500
                      }
                    },
                    "required": [
                      "copyIds",
                      "mailedOn"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "all": {
                        "type": "boolean",
                        "const": true
                      },
                      "expectedCount": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 500
                      },
                      "mailedOn": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "note": {
                        "type": "string",
                        "maxLength": 500
                      }
                    },
                    "required": [
                      "all",
                      "expectedCount",
                      "mailedOn"
                    ],
                    "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": {
                    "posted": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "posted"
                  ],
                  "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/slips/files/{fileId}/copy-notices": {
      "post": {
        "operationId": "draftSlipCopyNotices",
        "summary": "Drafts the notices that go with the copies of a slip file.",
        "description": "Drafts the notices that go with the copies of a slip file. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "limit": {
                    "default": 100,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  }
                },
                "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": {
                  "type": "object",
                  "properties": {
                    "drafted": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "noticeIds": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "remaining": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "skipped": {
                      "type": "object",
                      "properties": {
                        "noConsent": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "consentWithdrawn": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "addressChanged": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "noEmail": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "alreadyTold": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "draftOpen": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "noConsent",
                        "consentWithdrawn",
                        "addressChanged",
                        "noEmail",
                        "alreadyTold",
                        "draftOpen"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "drafted",
                    "noticeIds",
                    "remaining",
                    "skipped"
                  ],
                  "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/slips/non-resident": {
      "get": {
        "operationId": "getNonResidentSlipRegister",
        "summary": "Returns the register of slips for non-resident vendors.",
        "description": "Returns the register of slips for non-resident vendors. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "periodEnd",
            "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": {
                    "entity": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "periodStart": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "periodEnd": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "dueDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "currency": {
                      "type": "string",
                      "const": "CAD"
                    },
                    "rows": {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "vendor": {
                                "$ref": "#/components/schemas/Vendor3"
                              },
                              "recipientType": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "INDIVIDUAL",
                                      "CORPORATION",
                                      "PARTNERSHIP"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "country": {
                                "type": "string"
                              },
                              "grossFeesMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "withheldMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "waivedFeesMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "paymentCount": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "firstPaidOn": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "lastPaidOn": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "flagged": {
                                "type": "boolean"
                              },
                              "blocking": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "caveats": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "included": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "vendor",
                              "recipientType",
                              "country",
                              "grossFeesMinor",
                              "withheldMinor",
                              "waivedFeesMinor",
                              "paymentCount",
                              "firstPaidOn",
                              "lastPaidOn",
                              "flagged",
                              "blocking",
                              "caveats",
                              "included"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "data",
                        "nextCursor",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "grossFeesMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "withheldMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "included": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "blocked": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "grossFeesMinor",
                        "withheldMinor",
                        "included",
                        "blocked"
                      ],
                      "additionalProperties": false
                    },
                    "unpaidFlagged": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "reversedPayments": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "entity",
                    "periodStart",
                    "periodEnd",
                    "dueDate",
                    "currency",
                    "rows",
                    "totals",
                    "unpaidFlagged",
                    "reversedPayments",
                    "entityTimeZone"
                  ],
                  "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/slips/register": {
      "get": {
        "operationId": "getSlipRegister",
        "summary": "Returns the register of slips the company must file.",
        "description": "Returns the register of slips the company must file. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "T4A",
                "T5018"
              ]
            }
          },
          {
            "name": "periodEnd",
            "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
            }
          },
          {
            "name": "readiness",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NEEDS_DETAILS"
              ]
            }
          }
        ],
        "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": {
                    "entity": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "fiscalYearEndMonth": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "fiscalYearEndMonth"
                      ],
                      "additionalProperties": false
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "T4A",
                        "T5018"
                      ]
                    },
                    "periodStart": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "periodEnd": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "taxYear": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "dueDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "filer": {
                      "type": "object",
                      "properties": {
                        "complete": {
                          "type": "boolean"
                        },
                        "missing": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "complete",
                        "missing"
                      ],
                      "additionalProperties": false
                    },
                    "rows": {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "vendor": {
                                "$ref": "#/components/schemas/Vendor3"
                              },
                              "recipientType": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "INDIVIDUAL",
                                      "CORPORATION",
                                      "PARTNERSHIP"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "paidMinor": {
                                "type": "string"
                              },
                              "taxMinor": {
                                "type": "string"
                              },
                              "unsplitMinor": {
                                "type": "string"
                              },
                              "boxMinor": {
                                "type": "string"
                              },
                              "paymentCount": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "methods": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "method": {
                                      "type": "string",
                                      "enum": [
                                        "RUN",
                                        "CARD",
                                        "PAD",
                                        "ACCOUNT",
                                        "CHEQUE",
                                        "WIRE",
                                        "ETRANSFER",
                                        "OTHER"
                                      ]
                                    },
                                    "count": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "paidMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    }
                                  },
                                  "required": [
                                    "method",
                                    "count",
                                    "paidMinor"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "overThreshold": {
                                "type": "boolean"
                              },
                              "blocking": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "caveats": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "included": {
                                "type": "boolean"
                              },
                              "measuredMinor": {
                                "type": "string"
                              },
                              "projectedMinor": {
                                "type": "string"
                              },
                              "gapCodes": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "enum": [
                                    "RECIPIENT_TYPE",
                                    "SURNAME",
                                    "LEGAL_NAME",
                                    "BUSINESS_NUMBER",
                                    "PROVINCE",
                                    "COUNTRY"
                                  ]
                                }
                              },
                              "addressIncomplete": {
                                "type": "boolean"
                              },
                              "readiness": {
                                "type": "string",
                                "enum": [
                                  "NEEDS_DETAILS",
                                  "GAPS_UNDER_THRESHOLD",
                                  "READY"
                                ]
                              }
                            },
                            "required": [
                              "vendor",
                              "recipientType",
                              "paidMinor",
                              "taxMinor",
                              "unsplitMinor",
                              "boxMinor",
                              "paymentCount",
                              "methods",
                              "overThreshold",
                              "blocking",
                              "caveats",
                              "included",
                              "measuredMinor",
                              "projectedMinor",
                              "gapCodes",
                              "addressIncomplete",
                              "readiness"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "data",
                        "nextCursor",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "paidMinor": {
                          "type": "string"
                        },
                        "boxMinor": {
                          "type": "string"
                        },
                        "included": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "underThreshold": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "blocked": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "paidMinor",
                        "boxMinor",
                        "included",
                        "underThreshold",
                        "blocked"
                      ],
                      "additionalProperties": false
                    },
                    "filesProduced": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "latestFile": {
                      "$ref": "#/components/schemas/LatestFile"
                    },
                    "unpaidFlagged": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "reversedPayments": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "voidedSettlements": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "window": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "string",
                          "enum": [
                            "BEFORE",
                            "OPEN",
                            "FILING",
                            "PAST"
                          ]
                        },
                        "opensOn": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "dueDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        }
                      },
                      "required": [
                        "state",
                        "opensOn",
                        "dueDate"
                      ],
                      "additionalProperties": false
                    },
                    "today": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "periodVendors": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "readiness": {
                      "type": "object",
                      "properties": {
                        "needsDetails": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "gapsUnderThreshold": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "projectedOver": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "openSignals": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "needsDetails",
                        "gapsUnderThreshold",
                        "projectedOver",
                        "openSignals"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "entity",
                    "kind",
                    "periodStart",
                    "periodEnd",
                    "taxYear",
                    "dueDate",
                    "filer",
                    "rows",
                    "totals",
                    "filesProduced",
                    "latestFile",
                    "unpaidFlagged",
                    "reversedPayments",
                    "voidedSettlements",
                    "window",
                    "today",
                    "periodVendors",
                    "readiness"
                  ],
                  "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/source-transactions": {
      "get": {
        "operationId": "listSourceTransactions",
        "summary": "Lists the bank transactions from connected sources, with the server's total.",
        "description": "Lists the bank transactions from connected sources, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "banking-and-payments"
        ],
        "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
            }
          },
          {
            "name": "connectionId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "syncRunId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NEW",
                "MATCHED",
                "PROPOSED",
                "IGNORED"
              ]
            }
          }
        ],
        "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"
                          },
                          "connectionId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "syncRunId": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "NEW",
                              "MATCHED",
                              "PROPOSED",
                              "IGNORED"
                            ]
                          },
                          "txnDate": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "counterparty": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "connectionName": {
                            "type": "string"
                          },
                          "providerExternalId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "notInStatements": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "connectionId",
                          "syncRunId",
                          "kind",
                          "status",
                          "txnDate",
                          "description",
                          "counterparty",
                          "amountMinor",
                          "currency",
                          "connectionName",
                          "providerExternalId",
                          "notInStatements"
                        ],
                        "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/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"
          }
        }
      }
    },
    "/v1/summaries/accounts/{accountId}": {
      "get": {
        "operationId": "getAccountSummary",
        "summary": "Returns one account's balance in each company, the last day it was posted to and how many lines it holds.",
        "description": "Returns one account's balance in each company, the last day it was posted to and how many lines it holds. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "accountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "atLeast",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(0|[1-9]\\d{0,18})$"
            }
          }
        ],
        "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": {
                    "subject": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "code": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "code",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "companies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "balanceMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "lastPostedOn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "postedLineCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "asOfDay": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          }
                        },
                        "required": [
                          "entityId",
                          "entityName",
                          "currency",
                          "balanceMinor",
                          "lastPostedOn",
                          "postedLineCount",
                          "asOfDay"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "asOf": {
                      "$ref": "#/components/schemas/AsOf"
                    }
                  },
                  "required": [
                    "subject",
                    "companies",
                    "asOf"
                  ],
                  "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/summaries/customers/{customerId}": {
      "get": {
        "operationId": "getCustomerSummary",
        "summary": "Returns what one customer owes, by age, how fast they pay, their last payment and oldest open invoices.",
        "description": "Returns what one customer owes, by age, how fast they pay, their last payment and oldest open invoices. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "atLeast",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(0|[1-9]\\d{0,18})$"
            }
          }
        ],
        "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/GetCustomerSummaryResponse"
                }
              }
            }
          },
          "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/summaries/vendors/{vendorId}": {
      "get": {
        "operationId": "getVendorSummary",
        "summary": "Returns what is owed to one supplier, by age, how fast it is paid, the last payment and oldest open bills.",
        "description": "Returns what is owed to one supplier, by age, how fast it is paid, the last payment and oldest open bills. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "reports"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "atLeast",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(0|[1-9]\\d{0,18})$"
            }
          }
        ],
        "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/GetCustomerSummaryResponse"
                }
              }
            }
          },
          "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/tax/adjustments": {
      "post": {
        "operationId": "proposeTaxAdjustment",
        "summary": "Proposes an adjustment to a tax return, for a person to decide.",
        "description": "Proposes an adjustment to a tax return, for a person to decide. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "taxRegistrationId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "line": {
                    "type": "string",
                    "enum": [
                      "104",
                      "107",
                      "204",
                      "207"
                    ]
                  },
                  "amountMajor": {
                    "type": "string",
                    "pattern": "^\\d+(\\.\\d{1,2})?$"
                  },
                  "contraAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "memo": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "entryDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "taxRegistrationId",
                  "line",
                  "amountMajor",
                  "contraAccountId",
                  "memo",
                  "entryDate"
                ],
                "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/GetEntryResponse"
                }
              }
            }
          },
          "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/tax/centre": {
      "get": {
        "operationId": "taxCentre",
        "summary": "Returns the tax centre, with the tax position and what is due.",
        "description": "Returns the tax centre, with the tax position and what is due. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "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}$"
            }
          }
        ],
        "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}$"
                    },
                    "timeZone": {
                      "type": "string"
                    },
                    "cards": {
                      "$ref": "#/components/schemas/Cards"
                    },
                    "overdue": {
                      "$ref": "#/components/schemas/Cards"
                    },
                    "lateCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "filedElsewhere": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "registration": {
                            "$ref": "#/components/schemas/CreateTaxRegistrationResponse"
                          },
                          "asOf": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "timeZone": {
                            "type": "string"
                          },
                          "authority": {
                            "type": "string"
                          },
                          "form": {
                            "type": "string"
                          },
                          "portal": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "source": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "balances": {
                            "anyOf": [
                              {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "role": {
                                      "type": "string",
                                      "enum": [
                                        "COLLECTED",
                                        "PAID"
                                      ]
                                    },
                                    "account": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "code": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "code",
                                        "name"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "balanceMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    }
                                  },
                                  "required": [
                                    "role",
                                    "account",
                                    "balanceMinor"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "registration",
                          "asOf",
                          "timeZone",
                          "authority",
                          "form",
                          "portal",
                          "source",
                          "balances"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "unconfigured": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CreateTaxRegistrationResponse"
                      }
                    }
                  },
                  "required": [
                    "asOf",
                    "timeZone",
                    "cards",
                    "overdue",
                    "lateCount",
                    "filedElsewhere",
                    "unconfigured"
                  ],
                  "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/tax/checks/findings": {
      "get": {
        "operationId": "listTaxCheckFindings",
        "summary": "Lists the findings of the tax checks, with the server's total.",
        "description": "Lists the findings of the tax checks, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "DISMISSED",
                "CLEARED"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "EXPORT_CHARGED",
                "PRODUCT_TREATMENT",
                "PLACE_MISMATCH",
                "RATE_MISMATCH"
              ]
            }
          },
          {
            "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}$"
            }
          },
          {
            "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/ListTaxCheckFindingsResponseItem"
                      }
                    },
                    "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/tax/checks/findings/{findingId}/dismiss": {
      "post": {
        "operationId": "dismissTaxCheckFinding",
        "summary": "Dismisses a tax check finding with a reason.",
        "description": "Dismisses a tax check finding with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "findingId",
            "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/ListTaxCheckFindingsResponseItem"
                }
              }
            }
          },
          "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/tax/checks/runs": {
      "get": {
        "operationId": "listTaxCheckRuns",
        "summary": "Lists the runs of the tax checks.",
        "description": "Lists the runs of the tax checks. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "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": {
                          "id": {
                            "type": "string"
                          },
                          "asOf": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "startedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "finishedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "invoicesChecked": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "linesChecked": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "findingsRaised": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "findingsSeen": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "findingsCleared": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "causedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "id",
                          "asOf",
                          "startedAt",
                          "finishedAt",
                          "invoicesChecked",
                          "linesChecked",
                          "findingsRaised",
                          "findingsSeen",
                          "findingsCleared",
                          "causedBy"
                        ],
                        "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/tax/codes": {
      "get": {
        "operationId": "listTaxCodes",
        "summary": "Lists the tax codes the ledger applies.",
        "description": "Lists the tax codes the ledger applies. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "stable",
        "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": {
                          "id": {
                            "type": "string"
                          },
                          "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"
                              }
                            ]
                          },
                          "name": {
                            "type": "string"
                          },
                          "rateE5": {
                            "type": "string",
                            "pattern": "^\\d+$"
                          },
                          "effectiveFrom": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "effectiveTo": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "taxType",
                          "region",
                          "name",
                          "rateE5",
                          "effectiveFrom",
                          "effectiveTo"
                        ],
                        "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/tax/determine": {
      "post": {
        "operationId": "determineTax",
        "summary": "Determines the tax that applies to a line of a document.",
        "description": "Determines the tax that applies to a line of a document. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "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
                  },
                  "entryDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "context": {
                    "$ref": "#/components/schemas/Tax2"
                  },
                  "lines": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "minLength": 1
                        },
                        "accountId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "amountMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "tax": {
                          "$ref": "#/components/schemas/Tax"
                        }
                      },
                      "required": [
                        "key",
                        "accountId",
                        "amountMinor",
                        "tax"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "entityId",
                  "entryDate",
                  "currency",
                  "context",
                  "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": {
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "determination": {
                            "$ref": "#/components/schemas/Determination"
                          },
                          "overridden": {
                            "anyOf": [
                              {
                                "$ref": "#/components/schemas/Determination"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "key",
                          "determination",
                          "overridden"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "appended": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "accountId": {
                            "type": "string"
                          },
                          "accountCode": {
                            "type": "string"
                          },
                          "accountName": {
                            "type": "string"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "registrationId": {
                            "type": "string"
                          },
                          "codeName": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "accountId",
                          "accountCode",
                          "accountName",
                          "amountMinor",
                          "registrationId",
                          "codeName",
                          "reason"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "imbalanceMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    }
                  },
                  "required": [
                    "lines",
                    "appended",
                    "imbalanceMinor"
                  ],
                  "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/tax/overrides": {
      "get": {
        "operationId": "listTaxOverrides",
        "summary": "Lists the tax overrides made on the ledger.",
        "description": "Lists the tax overrides made on the ledger. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "taxRegistrationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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}$"
            }
          },
          {
            "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": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "lineId": {
                            "type": "string"
                          },
                          "entryId": {
                            "type": "string"
                          },
                          "entryNumber": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "entryDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "entryStatus": {
                            "type": "string"
                          },
                          "accountCode": {
                            "type": "string"
                          },
                          "accountName": {
                            "type": "string"
                          },
                          "functionalAmountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "engine": {
                            "anyOf": [
                              {
                                "$ref": "#/components/schemas/EngineOption1"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "human": {
                            "$ref": "#/components/schemas/EngineOption1"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "overriddenBy": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "email": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "name",
                              "email"
                            ],
                            "additionalProperties": false
                          },
                          "overriddenAt": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "lineId",
                          "entryId",
                          "entryNumber",
                          "entryDate",
                          "entryStatus",
                          "accountCode",
                          "accountName",
                          "functionalAmountMinor",
                          "engine",
                          "human",
                          "reason",
                          "overriddenBy",
                          "overriddenAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "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
                }
              }
            }
          },
          "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/tax/overrides/drafts": {
      "get": {
        "operationId": "listDraftTaxOverrides",
        "summary": "Lists the draft tax overrides waiting to be made.",
        "description": "Lists the draft tax overrides waiting to be made. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit: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": "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}$"
            }
          },
          {
            "name": "reason",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "given",
                "missing"
              ]
            }
          },
          {
            "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": {
                          "lineId": {
                            "type": "string"
                          },
                          "invoiceId": {
                            "type": "string"
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "entity": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "issueDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "stage": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "PENDING_APPROVAL"
                            ]
                          },
                          "row": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "description": {
                            "type": "string"
                          },
                          "item": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "account": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "currency": {
                            "type": "string"
                          },
                          "netMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "engine": {
                            "$ref": "#/components/schemas/Engine"
                          },
                          "human": {
                            "type": "object",
                            "properties": {
                              "treatment": {
                                "type": "string",
                                "enum": [
                                  "STANDARD",
                                  "ZERO_RATED",
                                  "EXEMPT",
                                  "OUT_OF_SCOPE",
                                  "RELIEVED"
                                ]
                              },
                              "taxMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "byItem": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "treatment",
                              "taxMinor",
                              "byItem"
                            ],
                            "additionalProperties": false
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "overriddenBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "email": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "name",
                                  "email"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "overriddenAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "lineId",
                          "invoiceId",
                          "customer",
                          "entity",
                          "issueDate",
                          "stage",
                          "row",
                          "description",
                          "item",
                          "account",
                          "currency",
                          "netMinor",
                          "engine",
                          "human",
                          "reason",
                          "overriddenBy",
                          "overriddenAt"
                        ],
                        "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/tax/registrations": {
      "get": {
        "operationId": "listTaxRegistrations",
        "summary": "Lists the tax registrations the company holds.",
        "description": "Lists the tax registrations the company holds. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "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
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "entityId",
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "taxType": {
                            "type": "string",
                            "enum": [
                              "GST_HST",
                              "QST",
                              "PST_BC",
                              "PST_SK",
                              "PST_MB",
                              "US_SALES_TAX"
                            ]
                          },
                          "registrationNumber": {
                            "type": "string"
                          },
                          "region": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^(CA|US)-[A-Z]{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "filingFrequency": {
                            "type": "string",
                            "enum": [
                              "MONTHLY",
                              "QUARTERLY",
                              "ANNUAL"
                            ]
                          },
                          "fiscalYearEndMonth": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 12
                          },
                          "effectiveFrom": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "effectiveTo": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "collectedAccount": {
                            "$ref": "#/components/schemas/Account"
                          },
                          "recoverableAccount": {
                            "$ref": "#/components/schemas/Account"
                          },
                          "instalmentAccount": {
                            "$ref": "#/components/schemas/Account"
                          },
                          "rebateAccount": {
                            "$ref": "#/components/schemas/Account"
                          },
                          "exchangeDifferenceAccount": {
                            "$ref": "#/components/schemas/Account"
                          },
                          "label": {
                            "type": "string"
                          },
                          "frequencyHistory": {
                            "$ref": "#/components/schemas/FrequencyHistory"
                          },
                          "itcWindow": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "fiscalYearEnd": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "years": {
                                    "anyOf": [
                                      {
                                        "type": "number",
                                        "const": 2
                                      },
                                      {
                                        "type": "number",
                                        "const": 4
                                      }
                                    ]
                                  },
                                  "declared": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "fiscalYearEnd",
                                  "years",
                                  "declared"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "entityName",
                          "taxType",
                          "registrationNumber",
                          "region",
                          "filingFrequency",
                          "fiscalYearEndMonth",
                          "effectiveFrom",
                          "effectiveTo",
                          "collectedAccount",
                          "recoverableAccount",
                          "instalmentAccount",
                          "rebateAccount",
                          "exchangeDifferenceAccount",
                          "label",
                          "frequencyHistory",
                          "itcWindow"
                        ],
                        "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": "createTaxRegistration",
        "summary": "Creates a tax registration for the company.",
        "description": "Creates a tax registration for the company. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "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
                  },
                  "taxType": {
                    "type": "string",
                    "enum": [
                      "GST_HST",
                      "QST",
                      "PST_BC",
                      "PST_SK",
                      "PST_MB",
                      "US_SALES_TAX"
                    ]
                  },
                  "registrationNumber": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  },
                  "region": {
                    "type": "string",
                    "pattern": "^(CA|US)-[A-Z]{2}$"
                  },
                  "filingFrequency": {
                    "type": "string",
                    "enum": [
                      "MONTHLY",
                      "QUARTERLY",
                      "ANNUAL"
                    ]
                  },
                  "fiscalYearEndMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "effectiveFrom": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "effectiveTo": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "collectedAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "recoverableAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "instalmentAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "rebateAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "exchangeDifferenceAccountId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "entityId",
                  "taxType",
                  "registrationNumber",
                  "filingFrequency",
                  "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/CreateTaxRegistrationResponse"
                }
              }
            }
          },
          "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/tax/registrations/{registrationId}": {
      "patch": {
        "operationId": "updateTaxRegistration",
        "summary": "Changes a tax registration.",
        "description": "Changes a tax registration. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "registrationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filingFrequency": {
                    "type": "string",
                    "enum": [
                      "MONTHLY",
                      "QUARTERLY",
                      "ANNUAL"
                    ]
                  },
                  "frequencyEffectiveFrom": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "fiscalYearEndMonth": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  },
                  "effectiveTo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "collectedAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "recoverableAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "instalmentAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "rebateAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "exchangeDifferenceAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "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/CreateTaxRegistrationResponse"
                }
              }
            }
          },
          "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/tax/registrations/{registrationId}/itc-window": {
      "get": {
        "operationId": "listItcWindowDeclarations",
        "summary": "Lists the input tax credit windows declared under a registration.",
        "description": "Lists the input tax credit windows declared under a registration. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "registrationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 12,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          },
          {
            "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/ListItcWindowDeclarationsResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "years": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fiscalYearEnd": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "years": {
                            "anyOf": [
                              {
                                "type": "number",
                                "const": 2
                              },
                              {
                                "type": "number",
                                "const": 4
                              }
                            ]
                          },
                          "declared": {
                            "type": "boolean"
                          },
                          "declarationId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "fiscalYearEnd",
                          "years",
                          "declared",
                          "declarationId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "defaultFiscalYearEnd": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "years",
                    "defaultFiscalYearEnd"
                  ],
                  "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": "declareItcWindow",
        "summary": "Declares an input tax credit window under a registration.",
        "description": "Declares an input tax credit window under a registration. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "registrationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fiscalYearEnd": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "years": {
                    "anyOf": [
                      {
                        "type": "number",
                        "const": 2
                      },
                      {
                        "type": "number",
                        "const": 4
                      }
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "LISTED_FINANCIAL_INSTITUTION",
                      "THRESHOLD_OVER_6M",
                      "NOT_APPLICABLE"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "fiscalYearEnd",
                  "years",
                  "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/ListItcWindowDeclarationsResponseItem"
                }
              }
            }
          },
          "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/tax/returns": {
      "get": {
        "operationId": "listTaxReturns",
        "summary": "Lists the tax returns, with the server's total.",
        "description": "Lists the tax returns, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "taxRegistrationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "REVIEWED",
                "APPROVED",
                "FILED_EXTERNALLY"
              ]
            }
          },
          {
            "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"
                          },
                          "taxRegistrationId": {
                            "type": "string"
                          },
                          "registrationLabel": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "taxType": {
                            "type": "string",
                            "enum": [
                              "GST_HST",
                              "QST",
                              "PST_BC",
                              "PST_SK",
                              "PST_MB",
                              "US_SALES_TAX"
                            ]
                          },
                          "periodStart": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "periodEnd": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "REVIEWED",
                              "APPROVED",
                              "FILED_EXTERNALLY"
                            ]
                          },
                          "netTaxMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "generatedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "approvedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "email": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "name",
                                  "email"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "approvedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "filedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "email": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "name",
                                  "email"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "filedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "confirmationNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "taxRegistrationId",
                          "registrationLabel",
                          "entityId",
                          "entityName",
                          "taxType",
                          "periodStart",
                          "periodEnd",
                          "status",
                          "netTaxMinor",
                          "generatedAt",
                          "approvedBy",
                          "approvedAt",
                          "filedBy",
                          "filedAt",
                          "confirmationNumber"
                        ],
                        "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": "generateTaxReturn",
        "summary": "Generates a tax return for a period.",
        "description": "Generates a tax return for a period. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "taxRegistrationId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "periodStart": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "periodEnd": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "taxRegistrationId",
                  "periodStart",
                  "periodEnd"
                ],
                "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/GenerateTaxReturnResponse"
                }
              }
            }
          },
          "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/tax/returns/{returnId}": {
      "get": {
        "operationId": "getTaxReturn",
        "summary": "Returns one tax return with its boxes and status.",
        "description": "Returns one tax return with its boxes and status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "returnId",
            "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/GenerateTaxReturnResponse"
                }
              }
            }
          },
          "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"
          }
        }
      },
      "delete": {
        "operationId": "discardTaxReturn",
        "summary": "Discards a tax return that has not been approved.",
        "description": "Discards a tax return that has not been approved. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "returnId",
            "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"
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "taxRegistrationId": {
                      "type": "string"
                    },
                    "periodStart": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "periodEnd": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "DRAFT",
                        "REVIEWED",
                        "APPROVED",
                        "FILED_EXTERNALLY"
                      ]
                    },
                    "netTaxMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    }
                  },
                  "required": [
                    "id",
                    "entityId",
                    "taxRegistrationId",
                    "periodStart",
                    "periodEnd",
                    "status",
                    "netTaxMinor"
                  ],
                  "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/tax/returns/{returnId}/approve": {
      "post": {
        "operationId": "approveTaxReturn",
        "summary": "Approves a tax return so that it can be filed.",
        "description": "Approves a tax return so that it can be filed. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "returnId",
            "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/GenerateTaxReturnResponse"
                }
              }
            }
          },
          "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/tax/returns/{returnId}/audit": {
      "get": {
        "operationId": "listTaxReturnAudit",
        "summary": "Lists the audit trail of one tax return.",
        "description": "Lists the audit trail of one tax return. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "returnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "action",
            "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/tax/returns/{returnId}/itc-support": {
      "get": {
        "operationId": "getReturnItcSupport",
        "summary": "Returns the support for the input tax credits on a tax return.",
        "description": "Returns the support for the input tax credits on a tax return. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "returnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "result",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "FAILS",
                "UNTESTED",
                "NOT_TESTED",
                "PASSES"
              ]
            }
          },
          {
            "name": "window",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "outside"
              ]
            }
          },
          {
            "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": {
                          "key": {
                            "type": "string"
                          },
                          "billId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entryId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "entryNumber": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "supplierName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "postingDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "contributionMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "result": {
                            "type": "string",
                            "enum": [
                              "FAILS",
                              "UNTESTED",
                              "NOT_TESTED",
                              "PASSES"
                            ]
                          },
                          "notTestedReason": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "NO_BILL",
                                  "VOID",
                                  "NOT_CLAIMED"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "basis": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "DOCUMENT",
                                  "READING_MODEL",
                                  "STATEMENT"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "failing": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "DOCUMENT",
                                "SUPPLIER_NAME",
                                "DATE",
                                "TOTAL",
                                "REGISTRATION",
                                "TAX_SHOWN",
                                "RECIPIENT",
                                "TERMS",
                                "DESCRIPTIONS"
                              ]
                            }
                          },
                          "notRead": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "DOCUMENT",
                                "SUPPLIER_NAME",
                                "DATE",
                                "TOTAL",
                                "REGISTRATION",
                                "TAX_SHOWN",
                                "RECIPIENT",
                                "TERMS",
                                "DESCRIPTIONS"
                              ]
                            }
                          },
                          "untestedReason": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "NO_FUNCTIONAL_TOTAL",
                                  "ELEMENTS_NOT_READ"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lastDay": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "outsideWindow": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "key",
                          "billId",
                          "entryId",
                          "entryNumber",
                          "supplierName",
                          "number",
                          "billDate",
                          "postingDate",
                          "contributionMinor",
                          "result",
                          "notTestedReason",
                          "basis",
                          "failing",
                          "notRead",
                          "untestedReason",
                          "lastDay",
                          "outsideWindow"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "summary": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "line106Minor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "supportedByDocumentMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "supportedByReadingMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "supportedByStatementMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "unsupportedMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "untestedMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "notTestedMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "outsideWindowMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "counts": {
                          "type": "object",
                          "properties": {
                            "passes": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "fails": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "untested": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "notTested": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "outsideWindow": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "passes",
                            "fails",
                            "untested",
                            "notTested",
                            "outsideWindow"
                          ],
                          "additionalProperties": false
                        },
                        "readAt": {
                          "type": "string",
                          "minLength": 20
                        },
                        "ownWindow": {
                          "$ref": "#/components/schemas/Window2"
                        }
                      },
                      "required": [
                        "currency",
                        "line106Minor",
                        "supportedByDocumentMinor",
                        "supportedByReadingMinor",
                        "supportedByStatementMinor",
                        "unsupportedMinor",
                        "untestedMinor",
                        "notTestedMinor",
                        "outsideWindowMinor",
                        "counts",
                        "readAt",
                        "ownWindow"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "summary"
                  ],
                  "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/tax/returns/{returnId}/lines/{line}": {
      "get": {
        "operationId": "returnLineComposition",
        "summary": "Returns how one line of a tax return is composed.",
        "description": "Returns how one line of a tax return is composed. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "returnId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "line",
            "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": {
                          "lineId": {
                            "type": "string"
                          },
                          "entryId": {
                            "type": "string"
                          },
                          "entryNumber": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "entryDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "accountCode": {
                            "type": "string"
                          },
                          "accountName": {
                            "type": "string"
                          },
                          "memo": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "functionalAmountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "contributionMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "treatment": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "STANDARD",
                                  "ZERO_RATED",
                                  "EXEMPT",
                                  "OUT_OF_SCOPE",
                                  "RELIEVED"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "codeName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "itcRecoverablePct": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[01]\\.\\d{4}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "lineId",
                          "entryId",
                          "entryNumber",
                          "entryDate",
                          "accountCode",
                          "accountName",
                          "memo",
                          "functionalAmountMinor",
                          "contributionMinor",
                          "treatment",
                          "codeName",
                          "itcRecoverablePct"
                        ],
                        "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/tax/returns/{returnId}/regenerate": {
      "post": {
        "operationId": "regenerateTaxReturn",
        "summary": "Regenerates a tax return from the current ledger.",
        "description": "Regenerates a tax return from the current ledger. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "returnId",
            "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/GenerateTaxReturnResponse"
                }
              }
            }
          },
          "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/tax/setup-check": {
      "get": {
        "operationId": "getTaxSetupCheck",
        "summary": "Returns the check of the tax setup the ledger needs before it issues tax.",
        "description": "Returns the check of the tax setup the ledger needs before it issues tax. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "tax"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "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": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "CUSTOMER_NO_PROVINCE",
                              "ITEM_HINT_NO_REASON",
                              "NO_REGISTRATION",
                              "NO_TAX_CODE"
                            ]
                          },
                          "subject": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "CUSTOMER",
                                  "PRODUCT",
                                  "REGISTRATION",
                                  "COMPANY"
                                ]
                              },
                              "id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "message": {
                            "type": "string"
                          },
                          "remedy": {
                            "type": "string",
                            "minLength": 1
                          },
                          "fixHref": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "kind",
                          "subject",
                          "message",
                          "remedy",
                          "fixHref"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "checkedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "checkedOn": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "counts": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string",
                        "enum": [
                          "CUSTOMER_NO_PROVINCE",
                          "ITEM_HINT_NO_REASON",
                          "NO_REGISTRATION",
                          "NO_TAX_CODE"
                        ]
                      },
                      "additionalProperties": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "required": [
                        "CUSTOMER_NO_PROVINCE",
                        "ITEM_HINT_NO_REASON",
                        "NO_REGISTRATION",
                        "NO_TAX_CODE"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "checkedAt",
                    "checkedOn",
                    "counts"
                  ],
                  "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/test-copies/current": {
      "get": {
        "operationId": "getTestCopy",
        "summary": "Reads the test copy of these books, or the copy these books belong to, with its generations and what the caller may do.",
        "description": "Reads the test copy of these books, or the copy these books belong to, with its generations and what the caller may do. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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": {
                    "testCopy": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/TestCopy"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "testCopy"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/test-copies/requests": {
      "post": {
        "operationId": "requestTestCopy",
        "summary": "Asks for a test copy of these books, or a refreshed one, for a second administrator to approve.",
        "description": "Asks for a test copy of these books, or a refreshed one, for a second administrator to approve. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestTestCopyRequest"
              }
            }
          }
        },
        "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": [
                    {
                      "type": "object",
                      "properties": {
                        "outcome": {
                          "type": "string",
                          "const": "proposed"
                        },
                        "proposalId": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "outcome",
                        "proposalId"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "outcome": {
                          "type": "string",
                          "const": "started"
                        },
                        "testCopy": {
                          "$ref": "#/components/schemas/TestCopy"
                        }
                      },
                      "required": [
                        "outcome",
                        "testCopy"
                      ],
                      "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"
          }
        }
      }
    },
    "/v1/test-copies/start": {
      "post": {
        "operationId": "startTestCopy",
        "summary": "Starts the build of a test copy once the request is approved; reached only as the approval replay.",
        "description": "Starts the build of a test copy once the request is approved; reached only as the approval replay. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestTestCopyRequest"
              }
            }
          }
        },
        "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/TestCopy"
                    },
                    {
                      "$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/test-copies/{testCopyId}/delete": {
      "post": {
        "operationId": "deleteTestCopy",
        "summary": "Deletes a test copy: it is archived at once and purged after the retention days.",
        "description": "Deletes a test copy: it is archived at once and purged after the retention days. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "testCopyId",
            "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/TestCopy"
                }
              }
            }
          },
          "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/test-copies/{testCopyId}/discard": {
      "post": {
        "operationId": "discardTestCopyRefresh",
        "summary": "Discards a refreshed generation that was not switched to, keeping the current one.",
        "description": "Discards a refreshed generation that was not switched to, keeping the current one. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "testCopyId",
            "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/TestCopy"
                }
              }
            }
          },
          "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/test-copies/{testCopyId}/switch": {
      "post": {
        "operationId": "switchTestCopyGeneration",
        "summary": "Switches a test copy to its refreshed generation and archives the previous one.",
        "description": "Switches a test copy to its refreshed generation and archives the previous one. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "testCopyId",
            "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/TestCopy"
                }
              }
            }
          },
          "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/undo-groups": {
      "get": {
        "operationId": "listUndoGroups",
        "summary": "Lists the undo groups connected apps opened on a ledger, newest first, with the records each one changed.",
        "description": "Lists the undo groups connected apps opened on a ledger, newest first, with the records each one changed. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "appId",
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/GetUndoGroupResponse"
                      }
                    },
                    "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/undo-groups/{groupId}": {
      "get": {
        "operationId": "getUndoGroup",
        "summary": "Returns one undo group: the connected app, who it acted for, how many records it changed and when it closes.",
        "description": "Returns one undo group: the connected app, who it acted for, how many records it changed and when it closes. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "groupId",
            "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/GetUndoGroupResponse"
                }
              }
            }
          },
          "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/undo-groups/{groupId}/redo": {
      "post": {
        "operationId": "redoAgentBatch",
        "summary": "Puts back every change of an undone batch by inverting what the undo did, as the person, within its 24 hours.",
        "description": "Puts back every change of an undone batch by inverting what the undo did, as the person, within its 24 hours. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "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"
          },
          "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/undo-groups/{groupId}/undo": {
      "post": {
        "operationId": "undoAgentBatch",
        "summary": "Undoes every change one connected app made in an undo group, restoring records and reversing posted ones.",
        "description": "Undoes every change one connected app made in an undo group, restoring records and reversing posted ones. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "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"
          },
          "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/usage": {
      "get": {
        "operationId": "getLedgerUsage",
        "summary": "Reads how many API, MCP and web calls these books took this month, against the workspace's plan, and where they are kept.",
        "description": "Reads how many API, MCP and web calls these books took this month, against the workspace's plan, and where they are kept. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-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": {
                    "month": {
                      "type": "string",
                      "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                    },
                    "asOf": {
                      "type": "string",
                      "minLength": 20
                    },
                    "ledger": {
                      "type": "object",
                      "properties": {
                        "rest": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "mcp": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "web": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "refused": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "limited": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "rest",
                        "mcp",
                        "web",
                        "refused",
                        "limited"
                      ],
                      "additionalProperties": false
                    },
                    "days": {
                      "maxItems": 31,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "rest": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "mcp": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "web": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "refused": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "limited": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "day": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          }
                        },
                        "required": [
                          "rest",
                          "mcp",
                          "web",
                          "refused",
                          "limited",
                          "day"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "plan": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "code": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "monthlyCalls": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "keyReadsPerMinute": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "keyWritesPerMinute": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "grantReadsPerMinute": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "grantWritesPerMinute": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "code",
                                "name",
                                "monthlyCalls",
                                "keyReadsPerMinute",
                                "keyWritesPerMinute",
                                "grantReadsPerMinute",
                                "grantWritesPerMinute"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "counted": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "over": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "ledgers": {
                          "type": "integer",
                          "exclusiveMinimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "name",
                        "plan",
                        "counted",
                        "over",
                        "ledgers"
                      ],
                      "additionalProperties": false
                    },
                    "placement": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "SHARED",
                            "DEDICATED"
                          ]
                        },
                        "region": {
                          "type": "string",
                          "const": "Toronto"
                        }
                      },
                      "required": [
                        "kind",
                        "region"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "month",
                    "asOf",
                    "ledger",
                    "days",
                    "workspace",
                    "placement"
                  ],
                  "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/usage/subjects": {
      "get": {
        "operationId": "listUsageSubjects",
        "summary": "Lists the keys and connected apps that called these books this month, with their counts, most recently active first.",
        "description": "Lists the keys and connected apps that called these books this month, with their counts, most recently active first. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 25,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "month",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "subject": {
                            "type": "string",
                            "enum": [
                              "KEY",
                              "GRANT"
                            ]
                          },
                          "subjectId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "door": {
                            "type": "string",
                            "enum": [
                              "rest",
                              "mcp"
                            ]
                          },
                          "firstParty": {
                            "type": "boolean"
                          },
                          "reads": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "writes": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "refused": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "limited": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "busiestMinute": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "minute": {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  "calls": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "minute",
                                  "calls"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "subject",
                          "subjectId",
                          "name",
                          "door",
                          "firstParty",
                          "reads",
                          "writes",
                          "refused",
                          "limited",
                          "busiestMinute"
                        ],
                        "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/validation-rules": {
      "get": {
        "operationId": "listValidationRules",
        "summary": "Lists the validation rules the ledger defines, with the sentence each one reads as.",
        "description": "Lists the validation rules the ledger defines, with the sentence each one reads as. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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
            }
          },
          {
            "name": "recordKind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "CUSTOMER",
                "INVOICE",
                "CREDIT_MEMO",
                "PRODUCT",
                "CONTRACT",
                "VENDOR",
                "BILL",
                "PURCHASE_ORDER",
                "JOURNAL_ENTRY",
                "CUSTOM_OBJECT",
                "LINE"
              ]
            }
          },
          {
            "name": "objectKey",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,39}$"
            }
          },
          {
            "name": "lineKind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PURCHASE_ORDER_LINE",
                "GOODS_RECEIPT_LINE",
                "BILL_LINE",
                "VENDOR_CREDIT_LINE",
                "INVOICE_LINE",
                "CREDIT_MEMO_LINE",
                "JOURNAL_LINE"
              ]
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListValidationRulesResponseItem"
                      }
                    },
                    "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": "createValidationRule",
        "summary": "Defines a validation rule that refuses a record when its condition holds.",
        "description": "Defines a validation rule that refuses a record when its condition holds. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recordKind": {
                    "type": "string",
                    "enum": [
                      "CUSTOMER",
                      "INVOICE",
                      "CREDIT_MEMO",
                      "PRODUCT",
                      "CONTRACT",
                      "VENDOR",
                      "BILL",
                      "PURCHASE_ORDER",
                      "JOURNAL_ENTRY",
                      "CUSTOM_OBJECT",
                      "LINE"
                    ]
                  },
                  "objectKey": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,39}$"
                  },
                  "lineKind": {
                    "type": "string",
                    "enum": [
                      "PURCHASE_ORDER_LINE",
                      "GOODS_RECEIPT_LINE",
                      "BILL_LINE",
                      "VENDOR_CREDIT_LINE",
                      "INVOICE_LINE",
                      "CREDIT_MEMO_LINE",
                      "JOURNAL_LINE"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "condition": {
                    "$ref": "#/components/schemas/Condition"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "fieldKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60,
                    "pattern": "^(cf\\.[a-z][a-z0-9_]{0,39}|[a-z][A-Za-z0-9]{0,39})$"
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000
                  }
                },
                "required": [
                  "recordKind",
                  "name",
                  "condition",
                  "message"
                ],
                "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/ListValidationRulesResponseItem"
                }
              }
            }
          },
          "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/validation-rules/{ruleId}": {
      "patch": {
        "operationId": "updateValidationRule",
        "summary": "Changes a validation rule's condition, message or position.",
        "description": "Changes a validation rule's condition, message or position. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "ruleId",
            "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
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "condition": {
                    "$ref": "#/components/schemas/Condition"
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "fieldKey": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60,
                        "pattern": "^(cf\\.[a-z][a-z0-9_]{0,39}|[a-z][A-Za-z0-9]{0,39})$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "position": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 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/ListValidationRulesResponseItem"
                }
              }
            }
          },
          "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/validation-rules/{ruleId}/archive": {
      "post": {
        "operationId": "archiveValidationRule",
        "summary": "Archives a validation rule so it no longer applies.",
        "description": "Archives a validation rule so it no longer applies. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "ruleId",
            "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/ListValidationRulesResponseItem"
                }
              }
            }
          },
          "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/validation-rules/{ruleId}/restore": {
      "post": {
        "operationId": "restoreValidationRule",
        "summary": "Restores an archived validation rule.",
        "description": "Restores an archived validation rule. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "ruleId",
            "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/ListValidationRulesResponseItem"
                }
              }
            }
          },
          "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/vendor-agreements/deadlines": {
      "get": {
        "operationId": "listVendorAgreementDeadlines",
        "summary": "Lists the deadlines of vendor agreements.",
        "description": "Lists the deadlines of vendor agreements. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "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": "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": {
                          "agreementId": {
                            "type": "string"
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "entity": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "name": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "ACT_BY",
                              "ENDS"
                            ]
                          },
                          "date": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "daysUntil": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "OVERDUE",
                              "DUE_SOON",
                              "UPCOMING",
                              "DONE"
                            ]
                          },
                          "owner": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "decision": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "RENEW",
                                  "LET_END"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "timeZone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "agreementId",
                          "vendor",
                          "entity",
                          "name",
                          "kind",
                          "date",
                          "daysUntil",
                          "status",
                          "owner",
                          "decision",
                          "timeZone"
                        ],
                        "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/vendor-credits": {
      "get": {
        "operationId": "listVendorCredits",
        "summary": "Lists the vendor credits, with the server's total.",
        "description": "Lists the vendor credits, with the server's total. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "IN_REVIEW",
                "APPROVED",
                "APPLIED",
                "VOID"
              ]
            }
          },
          {
            "name": "open",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "only"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "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}$"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "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"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "IN_REVIEW",
                              "APPROVED",
                              "APPLIED",
                              "VOID"
                            ]
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "vendorId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "vendorName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "supplierName": {
                            "type": "string"
                          },
                          "creditDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "postingDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "remainingMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "adjustsBill": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "number"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "INBOX_DOCUMENT",
                              "MANUAL",
                              "IMPORT"
                            ]
                          },
                          "actorType": {
                            "type": "string",
                            "enum": [
                              "USER",
                              "AGENT"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "number",
                          "status",
                          "entityId",
                          "entityName",
                          "vendorId",
                          "vendorName",
                          "supplierName",
                          "creditDate",
                          "postingDate",
                          "currency",
                          "totalMinor",
                          "remainingMinor",
                          "adjustsBill",
                          "source",
                          "actorType"
                        ],
                        "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": "createVendorCredit",
        "summary": "Creates a draft vendor credit from a vendor.",
        "description": "Creates a draft vendor credit from a vendor. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
                  },
                  "vendorId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "number": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "creditDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "reason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "memo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "payableAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "adjustsBillId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "deliveryRegion": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^(CA|US)-[A-Z]{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "documentId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines8"
                  }
                },
                "required": [
                  "entityId",
                  "creditDate",
                  "currency",
                  "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"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateVendorCreditResponse"
                }
              }
            }
          },
          "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/vendor-credits/applications": {
      "get": {
        "operationId": "listVendorCreditApplications",
        "summary": "Lists the applications of vendor credits against bills.",
        "description": "Lists the applications of vendor credits against bills. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "billId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "vendorCreditId",
            "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": {
                          "id": {
                            "type": "string"
                          },
                          "vendorCreditId": {
                            "type": "string"
                          },
                          "vendorCreditNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billId": {
                            "type": "string"
                          },
                          "billNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "appliedOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "LIVE",
                              "IN_DRAFT_RUN",
                              "WITH_PAYMENT",
                              "LAPSED",
                              "UNAPPLIED"
                            ]
                          },
                          "run": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "number"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "applied": {
                            "type": "object",
                            "properties": {
                              "byName": {
                                "type": "string"
                              },
                              "at": {
                                "type": "string",
                                "minLength": 20
                              }
                            },
                            "required": [
                              "byName",
                              "at"
                            ],
                            "additionalProperties": false
                          },
                          "voided": {
                            "$ref": "#/components/schemas/Retired2"
                          },
                          "proposed": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "vendorCreditId",
                          "vendorCreditNumber",
                          "billId",
                          "billNumber",
                          "billDate",
                          "amountMinor",
                          "currency",
                          "appliedOn",
                          "state",
                          "run",
                          "applied",
                          "voided",
                          "proposed"
                        ],
                        "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/vendor-credits/{vendorCreditId}": {
      "get": {
        "operationId": "getVendorCredit",
        "summary": "Returns one vendor credit with its lines and status.",
        "description": "Returns one vendor credit with its lines and status. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorCreditId",
            "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"
                    },
                    "number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "DRAFT",
                        "IN_REVIEW",
                        "APPROVED",
                        "APPLIED",
                        "VOID"
                      ]
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "vendorId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "vendorName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "supplierName": {
                      "type": "string"
                    },
                    "creditDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "postingDate": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "totalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "remainingMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "adjustsBill": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "number": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "number"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "INBOX_DOCUMENT",
                        "MANUAL",
                        "IMPORT"
                      ]
                    },
                    "actorType": {
                      "type": "string",
                      "enum": [
                        "USER",
                        "AGENT"
                      ]
                    },
                    "appliedMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "refundedMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "subtotalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "taxMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "memo": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "payableAccount": {
                      "$ref": "#/components/schemas/Account"
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "position": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "description": {
                            "type": "string"
                          },
                          "account": {
                            "$ref": "#/components/schemas/Account"
                          },
                          "quantity": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "unitPriceMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "taxAsPrintedMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "supplyCategory": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "GOODS",
                                  "SERVICES",
                                  "INTANGIBLE_PROPERTY",
                                  "REAL_PROPERTY"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "taxAmountMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "taxProvincialAmountMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "dimensions": {
                            "$ref": "#/components/schemas/Dimensions"
                          },
                          "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"
                              }
                            ]
                          },
                          "purchaseOrderLine": {
                            "$ref": "#/components/schemas/PurchaseOrderLine"
                          },
                          "customFields": {
                            "description": "The line's own fields, by the field's key.",
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": [
                                "string",
                                "boolean"
                              ]
                            },
                            "x-stability-level": "beta"
                          },
                          "carriedFrom": {
                            "$ref": "#/components/schemas/CarriedFrom"
                          },
                          "adjustsBillLineId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "position",
                          "description",
                          "account",
                          "quantity",
                          "unitPriceMinor",
                          "amountMinor",
                          "taxAsPrintedMinor",
                          "supplyCategory",
                          "taxAmountMinor",
                          "taxProvincialAmountMinor",
                          "dimensions",
                          "servicePeriodStart",
                          "servicePeriodEnd",
                          "purchaseOrderLine",
                          "adjustsBillLineId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "findings": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FindingsItem"
                      }
                    },
                    "deliveryRegion": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^(CA|US)-[A-Z]{2}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "drafted": {
                      "type": "object",
                      "properties": {
                        "byName": {
                          "type": "string"
                        },
                        "at": {
                          "type": "string",
                          "minLength": 20
                        },
                        "actorType": {
                          "type": "string",
                          "enum": [
                            "USER",
                            "AGENT"
                          ]
                        },
                        "agentLabel": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "byName",
                        "at",
                        "actorType",
                        "agentLabel"
                      ],
                      "additionalProperties": false
                    },
                    "approved": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "byName": {
                              "type": "string"
                            },
                            "at": {
                              "type": "string",
                              "minLength": 20
                            }
                          },
                          "required": [
                            "byName",
                            "at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "voided": {
                      "$ref": "#/components/schemas/Retired2"
                    },
                    "entry": {
                      "$ref": "#/components/schemas/Entry2"
                    },
                    "voidEntry": {
                      "$ref": "#/components/schemas/Entry2"
                    },
                    "document": {
                      "$ref": "#/components/schemas/Document"
                    },
                    "fx": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/Conversion"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "number",
                    "status",
                    "entityId",
                    "entityName",
                    "vendorId",
                    "vendorName",
                    "supplierName",
                    "creditDate",
                    "postingDate",
                    "currency",
                    "totalMinor",
                    "remainingMinor",
                    "adjustsBill",
                    "source",
                    "actorType",
                    "appliedMinor",
                    "refundedMinor",
                    "subtotalMinor",
                    "taxMinor",
                    "reason",
                    "memo",
                    "payableAccount",
                    "lines",
                    "findings",
                    "deliveryRegion",
                    "drafted",
                    "approved",
                    "voided",
                    "entry",
                    "voidEntry",
                    "document",
                    "fx",
                    "entityTimeZone"
                  ],
                  "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"
          }
        }
      },
      "patch": {
        "operationId": "updateVendorCredit",
        "summary": "Changes a draft vendor credit.",
        "description": "Changes a draft vendor credit. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorCreditId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "vendorId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "number": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "creditDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "reason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "memo": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "payableAccountId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "adjustsBillId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "deliveryRegion": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^(CA|US)-[A-Z]{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "documentId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines8"
                  }
                },
                "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/CreateVendorCreditResponse"
                }
              }
            }
          },
          "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/vendor-credits/{vendorCreditId}/applications": {
      "post": {
        "operationId": "applyVendorCredit",
        "summary": "Applies a vendor credit against a bill.",
        "description": "Applies a vendor credit against a bill. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorCreditId",
            "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": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "billId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "amountMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "billId",
                        "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/CreateVendorCreditResponse"
                }
              }
            }
          },
          "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/vendor-credits/{vendorCreditId}/applications/{applicationId}/void": {
      "post": {
        "operationId": "voidVendorCreditApplication",
        "summary": "Voids one application of a vendor credit.",
        "description": "Voids one application of a vendor credit. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorCreditId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "applicationId",
            "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/CreateVendorCreditResponse"
                }
              }
            }
          },
          "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/vendor-credits/{vendorCreditId}/approve": {
      "post": {
        "operationId": "approveVendorCredit",
        "summary": "Approves a vendor credit so that it can be applied or refunded.",
        "description": "Approves a vendor credit so that it can be applied or refunded. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorCreditId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "postingDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "applications": {
                    "default": [],
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "billId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "amountMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "billId",
                        "amountMinor"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "declineSuggestion": {
                    "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": {
                  "$ref": "#/components/schemas/CreateVendorCreditResponse"
                }
              }
            }
          },
          "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/vendor-credits/{vendorCreditId}/audit": {
      "get": {
        "operationId": "listVendorCreditAudit",
        "summary": "Lists the audit trail of one vendor credit.",
        "description": "Lists the audit trail of one vendor credit. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorCreditId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "action",
            "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/vendor-credits/{vendorCreditId}/decline": {
      "post": {
        "operationId": "declineVendorCredit",
        "summary": "Declines a submitted vendor credit with a reason.",
        "description": "Declines a submitted vendor credit with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorCreditId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "NOT_A_CREDIT",
                      "WRONG_FIGURES",
                      "WRONG_SUPPLIER",
                      "OTHER"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "kind",
                  "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/CreateVendorCreditResponse"
                }
              }
            }
          },
          "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/vendor-credits/{vendorCreditId}/discard": {
      "post": {
        "operationId": "discardVendorCredit",
        "summary": "Discards a draft vendor credit that has not been submitted.",
        "description": "Discards a draft vendor credit that has not been submitted. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorCreditId",
            "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/CreateVendorCreditResponse"
                }
              }
            }
          },
          "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/vendor-credits/{vendorCreditId}/refunds": {
      "get": {
        "operationId": "listVendorCreditRefunds",
        "summary": "Lists the refunds received for a vendor credit.",
        "description": "Lists the refunds received for a vendor credit. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorCreditId",
            "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": {
                        "$ref": "#/components/schemas/ListVendorCreditRefundsResponseItem"
                      }
                    },
                    "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": "recordVendorCreditRefund",
        "summary": "Records a refund received from a vendor for a vendor credit.",
        "description": "Records a refund received from a vendor for a vendor credit. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorCreditId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "receivedOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "financialAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "receivedAmountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "reference": {
                    "type": "string",
                    "maxLength": 60
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "sourceTransactionId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "receivedOn",
                  "financialAccountId",
                  "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": {
                  "$ref": "#/components/schemas/ListVendorCreditRefundsResponseItem"
                }
              }
            }
          },
          "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/vendor-credits/{vendorCreditId}/refunds/{refundId}/approve": {
      "post": {
        "operationId": "approveVendorCreditRefund",
        "summary": "Approves a refund received from a vendor.",
        "description": "Approves a refund received from a vendor. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorCreditId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "refundId",
            "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/ListVendorCreditRefundsResponseItem"
                }
              }
            }
          },
          "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/vendor-credits/{vendorCreditId}/refunds/{refundId}/void": {
      "post": {
        "operationId": "voidVendorCreditRefund",
        "summary": "Voids a refund received from a vendor.",
        "description": "Voids a refund received from a vendor. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorCreditId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "refundId",
            "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/ListVendorCreditRefundsResponseItem"
                }
              }
            }
          },
          "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/vendor-credits/{vendorCreditId}/submit": {
      "post": {
        "operationId": "submitVendorCredit",
        "summary": "Submits a vendor credit for approval.",
        "description": "Submits a vendor credit for approval. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorCreditId",
            "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/CreateVendorCreditResponse"
                }
              }
            }
          },
          "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/vendor-credits/{vendorCreditId}/void": {
      "post": {
        "operationId": "voidVendorCredit",
        "summary": "Voids a vendor credit, reversing its posting.",
        "description": "Voids a vendor credit, reversing its posting. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorCreditId",
            "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/CreateVendorCreditResponse"
                }
              }
            }
          },
          "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/vendor-look-alikes": {
      "get": {
        "operationId": "listVendorLookAlikes",
        "summary": "Lists the vendors that look alike, so duplicates can be found.",
        "description": "Lists the vendors that look alike, so duplicates can be found. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "taxNumber",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 20
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 8,
              "type": "integer",
              "minimum": 1,
              "maximum": 8
            }
          },
          {
            "name": "exceptId",
            "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": {
                    "matches": {
                      "maxItems": 8,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "SAME_BUSINESS_NUMBER",
                              "KNOWN_AS",
                              "SIMILAR_NAME"
                            ]
                          },
                          "vendorId": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "ACTIVE",
                              "ARCHIVED"
                            ]
                          },
                          "matchedName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "businessNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "lastBilledOn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "kind",
                          "vendorId",
                          "displayName",
                          "status",
                          "matchedName",
                          "businessNumber",
                          "billCount",
                          "lastBilledOn"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "more": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "matches",
                    "more"
                  ],
                  "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/vendor-merge-suggestions": {
      "get": {
        "operationId": "listVendorMergeSuggestions",
        "summary": "Lists the vendor merges the ledger suggests.",
        "description": "Lists the vendor merges the ledger suggests. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "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": {
                          "survivor": {
                            "$ref": "#/components/schemas/Survivor3"
                          },
                          "absorbed": {
                            "$ref": "#/components/schemas/Survivor3"
                          },
                          "kinds": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "SAME_BUSINESS_NUMBER",
                                "SAME_BANK_ACCOUNT",
                                "SIMILAR_NAME"
                              ]
                            }
                          },
                          "sentence": {
                            "type": "string"
                          },
                          "suggestedKeepId": {
                            "type": "string"
                          },
                          "suggestedKeepWhy": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "survivor",
                          "absorbed",
                          "kinds",
                          "sentence",
                          "suggestedKeepId",
                          "suggestedKeepWhy"
                        ],
                        "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/vendor-merge-suggestions/dismiss": {
      "post": {
        "operationId": "dismissVendorMergeSuggestion",
        "summary": "Dismisses a suggested vendor merge.",
        "description": "Dismisses a suggested vendor merge. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "vendorAId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "vendorBId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "note": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 500
                  }
                },
                "required": [
                  "vendorAId",
                  "vendorBId",
                  "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": {
                  "type": "object",
                  "properties": {
                    "vendorAId": {
                      "type": "string"
                    },
                    "vendorBId": {
                      "type": "string"
                    },
                    "dismissedBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "dismissedAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "vendorAId",
                    "vendorBId",
                    "dismissedBy",
                    "dismissedAt"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/vendor-merges": {
      "get": {
        "operationId": "listVendorMerges",
        "summary": "Lists the vendor merges, with the server's total.",
        "description": "Lists the vendor merges, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PROPOSED",
                "APPROVED",
                "REJECTED",
                "WITHDRAWN",
                "EXPIRED"
              ]
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "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/ListVendorMergesResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "proposed": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "expired": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "proposed",
                        "expired"
                      ],
                      "additionalProperties": false
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "counts",
                    "entityTimeZone"
                  ],
                  "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/vendor-merges/{mergeId}": {
      "get": {
        "operationId": "getVendorMerge",
        "summary": "Returns one vendor merge with what it moves.",
        "description": "Returns one vendor merge with what it moves. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "mergeId",
            "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/ListVendorMergesResponseItem"
                }
              }
            }
          },
          "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/vendor-merges/{mergeId}/reject": {
      "post": {
        "operationId": "rejectVendorMerge",
        "summary": "Rejects a vendor merge with a reason.",
        "description": "Rejects a vendor merge with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "mergeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 500
                  }
                },
                "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/ListVendorMergesResponseItem"
                }
              }
            }
          },
          "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/vendor-merges/{mergeId}/withdraw": {
      "post": {
        "operationId": "withdrawVendorMerge",
        "summary": "Withdraws a proposed vendor merge.",
        "description": "Withdraws a proposed vendor merge. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "mergeId",
            "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/ListVendorMergesResponseItem"
                }
              }
            }
          },
          "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/vendor-notices": {
      "get": {
        "operationId": "listVendorNotices",
        "summary": "Lists the notices sent or waiting to be sent to vendors, with the server's total.",
        "description": "Lists the notices sent or waiting to be sent to vendors, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DRAFTED",
                "SENT",
                "SUPPRESSED",
                "BOUNCED"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Kind5"
            }
          },
          {
            "name": "under",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "SETTING",
                "PERSON"
              ]
            }
          },
          {
            "name": "addressId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "inboundEmailId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "inboundRefusalId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "digestNoticeId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "paymentRunId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "paymentId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "billId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "vendorBankingChangeId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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}$"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "inboundRefusalIds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 12800
            }
          }
        ],
        "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/ListVendorNoticesResponseItem"
                      }
                    },
                    "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/vendor-notices/closing-drafts": {
      "post": {
        "operationId": "draftClosingNotices",
        "summary": "Drafts the notices that close out a vendor's account for a batch.",
        "description": "Drafts the notices that close out a vendor's account for a batch. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "inboundAddressId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "inboundAddressId"
                ],
                "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": {
                  "type": "object",
                  "properties": {
                    "drafted": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "noticeIds": {
                      "maxItems": 200,
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "skipped": {
                      "type": "object",
                      "properties": {
                        "alreadyTold": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "stopped": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "bounced": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "overCap": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "alreadyTold",
                        "stopped",
                        "bounced",
                        "overCap"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "drafted",
                    "noticeIds",
                    "skipped"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/vendor-notices/discard-batch": {
      "post": {
        "operationId": "discardNoticeBatch",
        "summary": "Discards a batch of drafted vendor notices that has not been sent.",
        "description": "Discards a batch of drafted vendor notices that has not been sent. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "noticeIds": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                },
                "required": [
                  "noticeIds",
                  "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": {
                    "discarded": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "skipped": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "discarded",
                    "skipped"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/vendor-notices/send-batch": {
      "post": {
        "operationId": "sendVendorNoticeBatch",
        "summary": "Sends a batch of vendor notices.",
        "description": "Sends a batch of vendor notices. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "noticeIds": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": [
                  "noticeIds"
                ],
                "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": {
                    "requested": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "noticeId": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "noticeId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "held": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "noticeId": {
                            "type": "string"
                          },
                          "why": {
                            "type": "string",
                            "enum": [
                              "RECIPIENT_STOPPED",
                              "RECIPIENT_BOUNCED",
                              "NO_NAMED_CONTACT",
                              "NEEDS_SECOND_PERSON",
                              "ALREADY_ASKED",
                              "NOT_DRAFTED"
                            ]
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "noticeId",
                          "why",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "requested",
                    "held"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/vendor-notices/{noticeId}": {
      "get": {
        "operationId": "getVendorNotice",
        "summary": "Returns one vendor notice with its text and its delivery status.",
        "description": "Returns one vendor notice with its text and its delivery status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "noticeId",
            "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/GetVendorNoticeResponse"
                }
              }
            }
          },
          "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/vendor-notices/{noticeId}/discard": {
      "post": {
        "operationId": "discardNotice",
        "summary": "Discards a vendor notice that has not been sent.",
        "description": "Discards a vendor notice that has not been sent. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "noticeId",
            "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": 4,
                    "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/GetVendorNoticeResponse"
                }
              }
            }
          },
          "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/vendor-notices/{noticeId}/send": {
      "post": {
        "operationId": "sendVendorNotice",
        "summary": "Sends one vendor notice.",
        "description": "Sends one vendor notice. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "noticeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "portalUrl": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  }
                },
                "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/GetVendorNoticeResponse"
                }
              }
            }
          },
          "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/vendor-notices/{noticeId}/sent": {
      "post": {
        "operationId": "recordNoticeSent",
        "summary": "Records that a vendor notice was sent outside the product.",
        "description": "Records that a vendor notice was sent outside the product. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "noticeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                },
                "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/GetVendorNoticeResponse"
                }
              }
            }
          },
          "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/vendor-portal-submissions": {
      "get": {
        "operationId": "listVendorPortalSubmissions",
        "summary": "Lists the submissions made through the vendor portal, with the server's total.",
        "description": "Lists the submissions made through the vendor portal, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DOCUMENT",
                "FACTS",
                "PAPER",
                "BANKING"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "RECEIVED",
                "ACCEPTED",
                "DECLINED",
                "WITHDRAWN",
                "ALL"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "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"
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "DOCUMENT",
                              "FACTS",
                              "PAPER",
                              "BANKING"
                            ]
                          },
                          "summary": {
                            "type": "string"
                          },
                          "receivedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "waitingDays": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "RECEIVED",
                              "ACCEPTED",
                              "DECLINED",
                              "WITHDRAWN"
                            ]
                          },
                          "decidedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "entityTimeZone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "vendor",
                          "kind",
                          "summary",
                          "receivedAt",
                          "waitingDays",
                          "state",
                          "decidedBy",
                          "entityTimeZone"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "RECEIVED": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "ACCEPTED": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "DECLINED": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "WITHDRAWN": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "DOCUMENTS": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "RECEIVED",
                        "ACCEPTED",
                        "DECLINED",
                        "WITHDRAWN",
                        "DOCUMENTS"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "counts"
                  ],
                  "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/vendor-portal-submissions/{submissionId}": {
      "get": {
        "operationId": "getVendorPortalSubmission",
        "summary": "Returns one vendor portal submission with its status.",
        "description": "Returns one vendor portal submission with its status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "submissionId",
            "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/GetVendorPortalSubmissionResponse"
                }
              }
            }
          },
          "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/vendor-portal-submissions/{submissionId}/decline": {
      "post": {
        "operationId": "declineVendorPortalSubmission",
        "summary": "Declines a vendor portal submission with a reason.",
        "description": "Declines a vendor portal submission with a reason. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "submissionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reasonCode": {
                    "type": "string",
                    "enum": [
                      "UNCLEAR_COPY",
                      "WRONG_DOCUMENT",
                      "ALREADY_ON_FILE",
                      "WILL_CALL",
                      "WRITE_TO_US"
                    ]
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "reasonCode"
                ],
                "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/GetVendorPortalSubmissionResponse"
                }
              }
            }
          },
          "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/vendor-privacy-requests": {
      "get": {
        "operationId": "listVendorPrivacyRequests",
        "summary": "Lists the privacy requests made about vendors, with the server's total.",
        "description": "Lists the privacy requests made about vendors, with the server's total. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "OPEN",
                    "PACK_TAKEN",
                    "WAITING",
                    "DONE",
                    "DECLINED",
                    "ANSWERED",
                    "WITHDRAWN"
                  ]
                },
                {
                  "type": "string",
                  "const": "OVERDUE"
                },
                {
                  "type": "string",
                  "const": "OPEN_ALL"
                },
                {
                  "type": "string",
                  "const": "ALL"
                }
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACCESS",
                "CONTACT_REDACTION",
                "BANKING_DIGITS_DESTRUCTION"
              ]
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "ACCESS",
                              "CONTACT_REDACTION",
                              "BANKING_DIGITS_DESTRUCTION"
                            ]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "OPEN",
                              "PACK_TAKEN",
                              "WAITING",
                              "DONE",
                              "DECLINED",
                              "ANSWERED",
                              "WITHDRAWN"
                            ]
                          },
                          "overdue": {
                            "type": "boolean"
                          },
                          "daysLeft": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "receivedOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "respondBy": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "requesterName": {
                            "type": "string"
                          },
                          "requestedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "requestedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "entityTimeZone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "vendor",
                          "kind",
                          "state",
                          "overdue",
                          "daysLeft",
                          "receivedOn",
                          "respondBy",
                          "requesterName",
                          "requestedBy",
                          "requestedAt",
                          "entityTimeZone"
                        ],
                        "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/vendor-privacy-requests/{requestId}": {
      "get": {
        "operationId": "getVendorPrivacyRequest",
        "summary": "Returns one vendor privacy request with its status.",
        "description": "Returns one vendor privacy request with its status. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "requestId",
            "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"
                    },
                    "vendor": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        },
                        "recipientType": {
                          "type": "string"
                        },
                        "language": {
                          "type": "string",
                          "enum": [
                            "en",
                            "fr"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "displayName",
                        "recipientType",
                        "language"
                      ],
                      "additionalProperties": false
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "ACCESS",
                        "CONTACT_REDACTION",
                        "BANKING_DIGITS_DESTRUCTION"
                      ]
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "PACK_TAKEN",
                        "WAITING",
                        "DONE",
                        "DECLINED",
                        "ANSWERED",
                        "WITHDRAWN"
                      ]
                    },
                    "overdue": {
                      "type": "boolean"
                    },
                    "daysLeft": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "receivedOn": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "respondBy": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "requesterName": {
                      "type": "string"
                    },
                    "requestedBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "requestedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "channel": {
                      "type": "string",
                      "enum": [
                        "EMAIL",
                        "LETTER",
                        "PHONE",
                        "IN_PERSON",
                        "OTHER"
                      ]
                    },
                    "identityCheck": {
                      "type": "string",
                      "enum": [
                        "REPLIED_FROM_ADDRESS_ON_FILE",
                        "CALLED_NUMBER_ON_FILE",
                        "DOCUMENT_SEEN",
                        "OTHER_STATED"
                      ]
                    },
                    "identityNote": {
                      "type": "string"
                    },
                    "message": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "read": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "promptVersion": {
                              "type": "string"
                            },
                            "proposed": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "SEE_WHAT_YOU_HOLD",
                                  "REMOVE_CONTACT_DETAILS",
                                  "REMOVE_BANK_ACCOUNT",
                                  "REMOVE_EVERYTHING",
                                  "CORRECT_DETAILS",
                                  "OTHER"
                                ]
                              }
                            },
                            "quotes": {
                              "$ref": "#/components/schemas/Quotes"
                            },
                            "language": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "en",
                                    "fr"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "addressedToSystem": {
                              "type": [
                                "boolean",
                                "null"
                              ]
                            },
                            "accepted": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "SEE_WHAT_YOU_HOLD",
                                  "REMOVE_CONTACT_DETAILS",
                                  "REMOVE_BANK_ACCOUNT",
                                  "REMOVE_EVERYTHING",
                                  "CORRECT_DETAILS",
                                  "OTHER"
                                ]
                              }
                            },
                            "declined": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "SEE_WHAT_YOU_HOLD",
                                  "REMOVE_CONTACT_DETAILS",
                                  "REMOVE_BANK_ACCOUNT",
                                  "REMOVE_EVERYTHING",
                                  "CORRECT_DETAILS",
                                  "OTHER"
                                ]
                              }
                            },
                            "added": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "SEE_WHAT_YOU_HOLD",
                                  "REMOVE_CONTACT_DETAILS",
                                  "REMOVE_BANK_ACCOUNT",
                                  "REMOVE_EVERYTHING",
                                  "CORRECT_DETAILS",
                                  "OTHER"
                                ]
                              }
                            }
                          },
                          "required": [
                            "promptVersion",
                            "proposed",
                            "quotes",
                            "language",
                            "addressedToSystem",
                            "accepted",
                            "declined",
                            "added"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "packContents": {
                      "anyOf": [
                        {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "section": {
                                "type": "string"
                              },
                              "rows": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "section",
                              "rows"
                            ],
                            "additionalProperties": false
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "bankingChange": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "summary": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "summary"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "permission": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "craReference": {
                              "type": "string"
                            },
                            "grantedOn": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "covers": {
                              "type": "string"
                            },
                            "voided": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "id",
                            "craReference",
                            "grantedOn",
                            "covers",
                            "voided"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "approval": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "by": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "at": {
                              "type": "string",
                              "minLength": 20
                            },
                            "note": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "planSha256": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            }
                          },
                          "required": [
                            "by",
                            "at",
                            "note",
                            "planSha256"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "decline": {
                      "$ref": "#/components/schemas/Retired"
                    },
                    "withdrawal": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "at": {
                              "type": "string",
                              "minLength": 20
                            },
                            "reason": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "at",
                            "reason"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "pack": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "downloadedAt": {
                              "type": "string",
                              "minLength": 20
                            },
                            "by": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "rowCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "downloadedAt",
                            "by",
                            "rowCount"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "packJob": {
                      "$ref": "#/components/schemas/Job2"
                    },
                    "answer": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "at": {
                              "type": "string",
                              "minLength": 20
                            },
                            "by": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "via": {
                              "type": "string",
                              "enum": [
                                "EMAIL",
                                "LETTER",
                                "PHONE",
                                "IN_PERSON",
                                "OTHER"
                              ]
                            },
                            "note": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "at",
                            "by",
                            "via",
                            "note"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "executed": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "cleared": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "boolean"
                                  }
                                ]
                              }
                            },
                            "kept": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "cleared",
                            "kept"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "plan": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "rows": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "item": {
                                    "type": "string"
                                  },
                                  "treatment": {
                                    "type": "string",
                                    "enum": [
                                      "CLEAR",
                                      "KEEP_ACT",
                                      "KEEP_EVIDENCE",
                                      "NOTHING_HELD"
                                    ]
                                  },
                                  "held": {
                                    "anyOf": [
                                      {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "because": {
                                    "type": "string"
                                  },
                                  "until": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "key",
                                  "item",
                                  "treatment",
                                  "held",
                                  "because",
                                  "until"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "retainUntil": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "sha256": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "moved": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "rows",
                            "retainUntil",
                            "sha256"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "answerDraft": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "language": {
                              "type": "string",
                              "enum": [
                                "en",
                                "fr"
                              ]
                            },
                            "subject": {
                              "type": "string"
                            },
                            "body": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "language",
                            "subject",
                            "body"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "vendor",
                    "kind",
                    "state",
                    "overdue",
                    "daysLeft",
                    "receivedOn",
                    "respondBy",
                    "requesterName",
                    "requestedBy",
                    "requestedAt",
                    "entityTimeZone",
                    "channel",
                    "identityCheck",
                    "identityNote",
                    "message",
                    "read",
                    "packContents",
                    "bankingChange",
                    "permission",
                    "approval",
                    "decline",
                    "withdrawal",
                    "pack",
                    "packJob",
                    "answer",
                    "executed",
                    "plan",
                    "answerDraft"
                  ],
                  "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/vendor-queries": {
      "get": {
        "operationId": "listVendorQueries",
        "summary": "Lists the vendor queries, with the server's total.",
        "description": "Lists the vendor queries, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "One or more values, separated by commas.",
            "schema": {
              "type": "string",
              "description": "One or more values, separated by commas."
            }
          },
          {
            "name": "turn",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "US",
                "SUPPLIER"
              ]
            }
          },
          {
            "name": "owner",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "billId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "aboutBillId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "paymentId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "vendorCreditId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "runId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "policyId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "origin",
            "in": "query",
            "required": false,
            "description": "One or more values, separated by commas.",
            "schema": {
              "type": "string",
              "description": "One or more values, separated by commas."
            }
          },
          {
            "name": "filedBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "policy",
                "person",
                "supplier"
              ]
            }
          },
          {
            "name": "mentionsBanking",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "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}$"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 40
            }
          },
          {
            "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"
                          },
                          "reference": {
                            "type": "string",
                            "pattern": "^Q-[0-9A-F]{10}$"
                          },
                          "title": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "OPEN",
                              "RESOLVED",
                              "SET_ASIDE"
                            ]
                          },
                          "turn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "US",
                                  "SUPPLIER"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "vendor": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "displayName": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "displayName"
                            ],
                            "additionalProperties": false
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "subject": {
                            "$ref": "#/components/schemas/Subject2"
                          },
                          "origin": {
                            "type": "string",
                            "enum": [
                              "PORTAL",
                              "EMAIL",
                              "RECORDED",
                              "OURS"
                            ]
                          },
                          "raisedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "lastMessageAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "messageCount": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "owner": {
                            "$ref": "#/components/schemas/Owner"
                          },
                          "mentionsBanking": {
                            "type": "boolean"
                          },
                          "filedUnder": {
                            "$ref": "#/components/schemas/FiledUnder"
                          },
                          "questionId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "followsQueryId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "aboutMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "aboutCurrency": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "waitingSince": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "closedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "reference",
                          "title",
                          "status",
                          "turn",
                          "vendor",
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "subject",
                          "origin",
                          "raisedAt",
                          "lastMessageAt",
                          "messageCount",
                          "owner",
                          "mentionsBanking",
                          "filedUnder",
                          "questionId",
                          "followsQueryId",
                          "aboutMinor",
                          "aboutCurrency",
                          "waitingSince",
                          "closedAt",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "open": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "waitingOnUs": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "waitingOnSupplier": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "resolved": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "setAside": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "open",
                        "waitingOnUs",
                        "waitingOnSupplier",
                        "resolved",
                        "setAside"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "counts"
                  ],
                  "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": "raiseVendorQuery",
        "summary": "Raises a query with a vendor about a bill or invoice, in our words, as a recorded conversation, or from an arrival's kept words.",
        "description": "Raises a query with a vendor about a bill or invoice, in our words, as a recorded conversation, or from an arrival's kept words. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "FROM_ARRIVAL"
                      },
                      "inboundEmailId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "vendorId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "subject": {
                        "$ref": "#/components/schemas/Subject3"
                      },
                      "title": {
                        "type": "string",
                        "minLength": 4,
                        "maxLength": 200
                      },
                      "ownerId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "addToQueryId": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "kind",
                      "inboundEmailId",
                      "subject"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "RECORDED"
                      },
                      "vendorId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "subject": {
                        "$ref": "#/components/schemas/Subject3"
                      },
                      "title": {
                        "type": "string",
                        "minLength": 4,
                        "maxLength": 200
                      },
                      "body": {
                        "type": "string",
                        "minLength": 4,
                        "maxLength": 4000
                      },
                      "channel": {
                        "type": "string",
                        "enum": [
                          "EMAIL",
                          "BY_HAND"
                        ]
                      },
                      "ownerId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "entityId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "followsQueryId": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "kind",
                      "vendorId",
                      "subject",
                      "title",
                      "body",
                      "channel"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "OURS"
                      },
                      "vendorId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "subject": {
                        "$ref": "#/components/schemas/Subject3"
                      },
                      "title": {
                        "type": "string",
                        "minLength": 4,
                        "maxLength": 200
                      },
                      "body": {
                        "type": "string",
                        "minLength": 4,
                        "maxLength": 4000
                      },
                      "delivery": {
                        "$ref": "#/components/schemas/Delivery"
                      },
                      "ownerId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "questionId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "entityId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "followsQueryId": {
                        "type": "string",
                        "minLength": 1
                      }
                    },
                    "required": [
                      "kind",
                      "vendorId",
                      "subject",
                      "title",
                      "body",
                      "delivery"
                    ],
                    "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/RaiseVendorQueryResponse"
                }
              }
            }
          },
          "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/vendor-queries/from-arrival/{inboundEmailId}": {
      "get": {
        "operationId": "getArrivalQueryFacts",
        "summary": "Returns the facts a query about an arrived email is built from.",
        "description": "Returns the facts a query about an arrived email is built from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "inboundEmailId",
            "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": {
                    "inboundEmailId": {
                      "type": "string"
                    },
                    "receivedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "senderDomain": {
                      "type": "string"
                    },
                    "authenticated": {
                      "type": "boolean"
                    },
                    "reading": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "verdict": {
                              "type": "string"
                            },
                            "decidedBy": {
                              "type": "string"
                            },
                            "reasonCode": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "verdict",
                            "decidedBy",
                            "reasonCode"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "suppliers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "vendorId": {
                            "type": "string"
                          },
                          "displayName": {
                            "type": "string"
                          },
                          "matchedOn": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "vendorId",
                          "displayName",
                          "matchedOn"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "suggestedSubject": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "BILL",
                            "VENDOR_CREDIT",
                            "AMBIGUOUS",
                            "VENDOR"
                          ]
                        },
                        "ids": {
                          "maxItems": 5,
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "label": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "ids",
                        "label"
                      ],
                      "additionalProperties": false
                    },
                    "reference": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "reference": {
                              "type": "string"
                            },
                            "queryId": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "reference",
                            "queryId"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "text": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string",
                      "maxLength": 200
                    },
                    "owner": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "because": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "because"
                      ],
                      "additionalProperties": false
                    },
                    "existingQuery": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "reference": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "reference"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "wouldBeFiled": {
                      "type": "object",
                      "properties": {
                        "yes": {
                          "type": "boolean"
                        },
                        "skip": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/SkipOption1"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "yes",
                        "skip"
                      ],
                      "additionalProperties": false
                    },
                    "notOffered": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "inboundEmailId",
                    "receivedAt",
                    "senderDomain",
                    "authenticated",
                    "reading",
                    "suppliers",
                    "suggestedSubject",
                    "reference",
                    "text",
                    "title",
                    "owner",
                    "existingQuery",
                    "wouldBeFiled",
                    "notOffered"
                  ],
                  "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/vendor-queries/payment-options": {
      "get": {
        "operationId": "listVendorQueryPaymentOptions",
        "summary": "Lists the payment options offered on vendor queries.",
        "description": "Lists the payment options offered on vendor queries. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "vendorId": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "runId": {
                            "type": "string"
                          },
                          "paidOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "chequeNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billNumbers": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "billsMore": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "entityTimeZone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "vendorId",
                          "entityId",
                          "runId",
                          "paidOn",
                          "amountMinor",
                          "currency",
                          "chequeNumber",
                          "billNumbers",
                          "billsMore",
                          "entityTimeZone"
                        ],
                        "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/vendor-queries/policies": {
      "get": {
        "operationId": "listVendorQueryPolicies",
        "summary": "Lists the policies that raise vendor queries automatically.",
        "description": "Lists the policies that raise vendor queries automatically. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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": {
                        "$ref": "#/components/schemas/ListVendorQueryPoliciesResponseItem"
                      }
                    },
                    "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/vendor-queries/policies/preview": {
      "get": {
        "operationId": "previewVendorQueryPolicy",
        "summary": "Previews a policy that raises vendor queries before it is started.",
        "description": "Previews a policy that raises vendor queries before it is started. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "dailyCap",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "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": {
                    "windowDays": {
                      "type": "number",
                      "const": 14
                    },
                    "wouldFile": {
                      "maxItems": 25,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "inboundEmailId": {
                            "type": "string"
                          },
                          "receivedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "vendorName": {
                            "type": "string"
                          },
                          "readingReasonCode": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "inboundEmailId",
                          "receivedAt",
                          "vendorName",
                          "readingReasonCode"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "wouldFileTotal": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "wouldSkip": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "reason": {
                            "$ref": "#/components/schemas/SkipOption1"
                          },
                          "count": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "reason",
                          "count"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "windowDays",
                    "wouldFile",
                    "wouldFileTotal",
                    "wouldSkip"
                  ],
                  "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/vendor-queries/policies/{policyId}/end": {
      "post": {
        "operationId": "endVendorQueryPolicy",
        "summary": "Ends a policy that raises vendor queries.",
        "description": "Ends a policy that raises vendor queries. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "policyId",
            "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": 4,
                    "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/ListVendorQueryPoliciesResponseItem"
                }
              }
            }
          },
          "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/vendor-queries/{queryId}": {
      "get": {
        "operationId": "getVendorQuery",
        "summary": "Returns one vendor query with its status.",
        "description": "Returns one vendor query with its status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "queryId",
            "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/RaiseVendorQueryResponse"
                }
              }
            }
          },
          "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/vendor-queries/{queryId}/answer": {
      "post": {
        "operationId": "answerVendorQuery",
        "summary": "Answers a vendor query on behalf of the ledger.",
        "description": "Answers a vendor query on behalf of the ledger. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "queryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "delivery": {
                    "$ref": "#/components/schemas/Delivery"
                  },
                  "factKeys": {
                    "$ref": "#/components/schemas/Keys"
                  },
                  "sentence": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 600
                      },
                      "source": {
                        "type": "string",
                        "enum": [
                          "STANDARD",
                          "AGENT_DRAFT",
                          "AGENT_DRAFT_EDITED",
                          "PERSON"
                        ]
                      },
                      "promptVersion": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80
                      }
                    },
                    "required": [
                      "text",
                      "source"
                    ],
                    "additionalProperties": false
                  },
                  "expectedSeq": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "draft": {
                    "default": {
                      "requested": false,
                      "proposedKeys": []
                    },
                    "type": "object",
                    "properties": {
                      "requested": {
                        "type": "boolean"
                      },
                      "category": {
                        "type": "string",
                        "enum": [
                          "PAYMENT_STATUS",
                          "SHORT_PAID",
                          "NOT_RECEIVED",
                          "DUE_DATE",
                          "AMOUNT_DIFFERS",
                          "REMITTANCE_ADVICE",
                          "CREDIT",
                          "OTHER"
                        ]
                      },
                      "proposedKeys": {
                        "default": [],
                        "maxItems": 11,
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/KeysItem"
                        }
                      }
                    },
                    "required": [
                      "requested"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "delivery",
                  "factKeys",
                  "expectedSeq"
                ],
                "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": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string",
                      "pattern": "^Q-[0-9A-F]{10}$"
                    },
                    "title": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "OPEN",
                        "RESOLVED",
                        "SET_ASIDE"
                      ]
                    },
                    "turn": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "US",
                            "SUPPLIER"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "vendor": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "displayName"
                      ],
                      "additionalProperties": false
                    },
                    "entityId": {
                      "type": "string"
                    },
                    "entityName": {
                      "type": "string"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "subject": {
                      "$ref": "#/components/schemas/Subject2"
                    },
                    "origin": {
                      "type": "string",
                      "enum": [
                        "PORTAL",
                        "EMAIL",
                        "RECORDED",
                        "OURS"
                      ]
                    },
                    "raisedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "lastMessageAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "messageCount": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "owner": {
                      "$ref": "#/components/schemas/Owner"
                    },
                    "mentionsBanking": {
                      "type": "boolean"
                    },
                    "filedUnder": {
                      "$ref": "#/components/schemas/FiledUnder"
                    },
                    "questionId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "followsQueryId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "aboutMinor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "aboutCurrency": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "waitingSince": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "closedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "sentence": {
                      "type": "string"
                    },
                    "draftPausedUntil": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "raisedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "arrival": {
                      "$ref": "#/components/schemas/Arrival"
                    },
                    "linkIssuer": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "closure": {
                      "$ref": "#/components/schemas/Closure"
                    },
                    "follows": {
                      "$ref": "#/components/schemas/Follows"
                    },
                    "blocked": {
                      "$ref": "#/components/schemas/Blocked"
                    },
                    "answerableBy": {
                      "$ref": "#/components/schemas/AnswerableBy"
                    },
                    "query": {
                      "$ref": "#/components/schemas/RaiseVendorQueryResponse"
                    },
                    "message": {
                      "$ref": "#/components/schemas/ListVendorQueryMessagesResponseItem"
                    },
                    "notice": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "reference",
                    "title",
                    "status",
                    "turn",
                    "vendor",
                    "entityId",
                    "entityName",
                    "entityTimeZone",
                    "subject",
                    "origin",
                    "raisedAt",
                    "lastMessageAt",
                    "messageCount",
                    "owner",
                    "mentionsBanking",
                    "filedUnder",
                    "questionId",
                    "followsQueryId",
                    "aboutMinor",
                    "aboutCurrency",
                    "waitingSince",
                    "closedAt",
                    "sentence",
                    "draftPausedUntil",
                    "raisedBy",
                    "arrival",
                    "linkIssuer",
                    "closure",
                    "follows",
                    "blocked",
                    "answerableBy",
                    "query",
                    "message",
                    "notice"
                  ],
                  "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/vendor-queries/{queryId}/answer-draft": {
      "post": {
        "operationId": "draftVendorQueryAnswer",
        "summary": "Drafts the answer to a vendor query for a person to send.",
        "description": "Drafts the answer to a vendor query for a person to send. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "queryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "availableFactKeys": {
                    "$ref": "#/components/schemas/ProposedKeys"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 280
                  }
                },
                "required": [
                  "availableFactKeys"
                ],
                "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": {
                    "drafted": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "category": {
                              "type": "string",
                              "enum": [
                                "PAYMENT_STATUS",
                                "SHORT_PAID",
                                "NOT_RECEIVED",
                                "DUE_DATE",
                                "AMOUNT_DIFFERS",
                                "REMITTANCE_ADVICE",
                                "CREDIT",
                                "OTHER"
                              ]
                            },
                            "factKeys": {
                              "$ref": "#/components/schemas/Keys"
                            },
                            "sentence": {
                              "type": "string",
                              "maxLength": 600
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "category",
                            "factKeys",
                            "sentence",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNPARSABLE",
                            "REFUSED",
                            "FIGURE_INVENTED",
                            "CONTACT_DETAIL",
                            "BANKING_WORDS",
                            "DECISION_PROMISE",
                            "PAUSED_AFTER_THREE_UNUSED",
                            "FACT_NOT_OFFERED",
                            "BANKING_MENTIONED",
                            "NOTHING_TO_ANSWER"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "resumesOn": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    }
                  },
                  "required": [
                    "drafted",
                    "why"
                  ],
                  "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/vendor-queries/{queryId}/assign": {
      "post": {
        "operationId": "assignVendorQuery",
        "summary": "Assigns a vendor query to a person.",
        "description": "Assigns a vendor query to a person. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "queryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ownerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "expectedOwnerId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "ownerId",
                  "expectedOwnerId"
                ],
                "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/RaiseVendorQueryResponse"
                }
              }
            }
          },
          "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/vendor-queries/{queryId}/evidence": {
      "get": {
        "operationId": "getVendorQueryEvidence",
        "summary": "Returns the evidence attached to one vendor query.",
        "description": "Returns the evidence attached to one vendor query. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "queryId",
            "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": {
                    "subject": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "BILL",
                            "PAYMENT",
                            "VENDOR_CREDIT",
                            "VENDOR"
                          ]
                        },
                        "label": {
                          "type": "string"
                        },
                        "href": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "remittanceHref": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "kind",
                        "label",
                        "href",
                        "remittanceHref"
                      ],
                      "additionalProperties": false
                    },
                    "facts": {
                      "minItems": 11,
                      "maxItems": 11,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "$ref": "#/components/schemas/KeysItem"
                          },
                          "tellable": {
                            "type": "boolean"
                          },
                          "text": {
                            "type": "string"
                          },
                          "why": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "key",
                          "tellable",
                          "text",
                          "why"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "internal": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "label",
                          "text"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "language": {
                      "type": "string",
                      "enum": [
                        "en",
                        "fr"
                      ]
                    },
                    "evidenceAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "mentionsBanking": {
                      "type": "boolean"
                    },
                    "contact": {
                      "$ref": "#/components/schemas/AnswerableBy"
                    },
                    "recipients": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/RecipientsItem"
                      }
                    },
                    "canEmail": {
                      "type": "object",
                      "properties": {
                        "yes": {
                          "type": "boolean"
                        },
                        "why": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "yes",
                        "why"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "subject",
                    "facts",
                    "internal",
                    "language",
                    "evidenceAt",
                    "mentionsBanking",
                    "contact",
                    "recipients",
                    "canEmail"
                  ],
                  "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/vendor-queries/{queryId}/messages": {
      "get": {
        "operationId": "listVendorQueryMessages",
        "summary": "Lists the messages on one vendor query.",
        "description": "Lists the messages on one vendor query. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "queryId",
            "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": {
                        "$ref": "#/components/schemas/ListVendorQueryMessagesResponseItem"
                      }
                    },
                    "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/vendor-queries/{queryId}/resolve": {
      "post": {
        "operationId": "resolveVendorQuery",
        "summary": "Resolves a vendor query with the outcome recorded.",
        "description": "Resolves a vendor query with the outcome recorded. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "queryId",
            "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": 4,
                    "maxLength": 2000
                  },
                  "expectedSeq": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "questionOutcome": {
                    "type": "string",
                    "enum": [
                      "NO_CHANGE",
                      "APPROVED",
                      "HELD",
                      "SENT_BACK",
                      "EDITED",
                      "SUPPLIER_ASKED",
                      "VOIDED"
                    ]
                  }
                },
                "required": [
                  "resolution",
                  "expectedSeq"
                ],
                "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/RaiseVendorQueryResponse"
                }
              }
            }
          },
          "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/vendor-queries/{queryId}/set-aside": {
      "post": {
        "operationId": "setAsideVendorQuery",
        "summary": "Sets a vendor query aside until a date.",
        "description": "Sets a vendor query aside until a date. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "queryId",
            "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": 4,
                    "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/RaiseVendorQueryResponse"
                }
              }
            }
          },
          "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/vendor-queries/{queryId}/supplier-reply": {
      "post": {
        "operationId": "recordVendorQuerySupplierReply",
        "summary": "Records the reply a vendor sent to a query.",
        "description": "Records the reply a vendor sent to a query. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "queryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 4000
                  },
                  "channel": {
                    "type": "string",
                    "enum": [
                      "EMAIL",
                      "BY_HAND"
                    ]
                  },
                  "expectedSeq": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "body",
                  "channel",
                  "expectedSeq"
                ],
                "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/RaiseVendorQueryResponse"
                }
              }
            }
          },
          "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/vendor-slip-identity-brief": {
      "post": {
        "operationId": "draftVendorSlipIdentity",
        "summary": "Drafts the identity details a vendor's slip filing needs.",
        "description": "Drafts the identity details a vendor's slip filing needs. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "displayName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "legalName": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "addressLine": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "displayName",
                  "addressLine"
                ],
                "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": {
                    "drafted": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "recipientType": {
                              "type": "string",
                              "enum": [
                                "INDIVIDUAL",
                                "CORPORATION",
                                "PARTNERSHIP"
                              ]
                            },
                            "surname": {
                              "type": "string",
                              "maxLength": 20
                            },
                            "givenName": {
                              "type": "string",
                              "maxLength": 12
                            },
                            "addressLine1": {
                              "type": "string",
                              "maxLength": 30
                            },
                            "addressLine2": {
                              "type": "string",
                              "maxLength": 30
                            },
                            "city": {
                              "type": "string",
                              "maxLength": 28
                            },
                            "region": {
                              "type": "string",
                              "pattern": "^[A-Z]{2}-[A-Z0-9]{1,3}$"
                            },
                            "postalCode": {
                              "type": "string",
                              "maxLength": 10
                            }
                          },
                          "required": [
                            "recipientType",
                            "addressLine1"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "type": "string",
                      "enum": [
                        "DISCLOSURE",
                        "BUDGET",
                        "PROVIDER",
                        "UNPARSABLE",
                        "REFUSED",
                        "PART_INVENTED",
                        "STOPPED_AFTER_THREE_REWRITES"
                      ]
                    }
                  },
                  "required": [
                    "drafted"
                  ],
                  "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/vendor-statements": {
      "post": {
        "operationId": "createVendorStatement",
        "summary": "Creates a statement of account received from a vendor.",
        "description": "Creates a statement of account received from a vendor. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "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
                  },
                  "vendorId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "UPLOAD",
                      "TYPED"
                    ]
                  },
                  "documentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "inboundEmailId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "statementDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "closingMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "basis": {
                    "type": "string",
                    "enum": [
                      "OPEN_ITEMS",
                      "ACTIVITY"
                    ]
                  },
                  "periodFrom": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "entityId",
                  "source"
                ],
                "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/CreateVendorStatementResponse"
                }
              }
            }
          },
          "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": "listVendorStatements",
        "summary": "Lists the vendor statements received, with the server's total.",
        "description": "Lists the vendor statements received, with the server's total. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "One or more of READING, IN_REVIEW, ACCEPTED, DISCARDED, separated by commas.",
            "schema": {
              "type": "string",
              "description": "One or more of READING, IN_REVIEW, ACCEPTED, DISCARDED, separated by commas."
            }
          },
          {
            "name": "vendorId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "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}$"
            }
          },
          {
            "name": "awaiting",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "const": "review"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "date_desc",
                "date_asc",
                "vendor_asc",
                "status_asc"
              ]
            }
          },
          {
            "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"
                          },
                          "vendor": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "UPLOAD",
                              "MAILED",
                              "TYPED"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "READING",
                              "IN_REVIEW",
                              "ACCEPTED",
                              "DISCARDED"
                            ]
                          },
                          "stalled": {
                            "type": "boolean"
                          },
                          "statementDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "statementNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "supplierNamePrinted": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "addedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "currency": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "readOutcome": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "OK",
                                  "NOT_A_STATEMENT",
                                  "UNREADABLE",
                                  "DISCLOSURE",
                                  "BUDGET",
                                  "PROVIDER",
                                  "UNPARSABLE",
                                  "REFUSED",
                                  "FILE_COLUMNS",
                                  "TOO_LONG"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "linesKept": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "acceptedBy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "acceptedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "addedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "differenceMinor": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "closing": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "askingCounts": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "differentOrTheirs": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "oursOnly": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "differentOrTheirs",
                                  "oursOnly"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "vendor",
                          "source",
                          "status",
                          "stalled",
                          "statementDate",
                          "statementNumber",
                          "supplierNamePrinted",
                          "addedBy",
                          "currency",
                          "readOutcome",
                          "linesKept",
                          "acceptedBy",
                          "acceptedAt",
                          "addedAt",
                          "differenceMinor",
                          "closing",
                          "askingCounts"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "reading": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "inReview": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "accepted": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "discarded": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "reading",
                        "inReview",
                        "accepted",
                        "discarded"
                      ],
                      "additionalProperties": false
                    },
                    "entityTimeZone": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "counts",
                    "entityTimeZone"
                  ],
                  "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/vendor-statements/{vendorStatementId}": {
      "get": {
        "operationId": "getVendorStatement",
        "summary": "Returns one vendor statement with its status.",
        "description": "Returns one vendor statement with its status. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorStatementId",
            "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/Statement2"
                }
              }
            }
          },
          "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": "updateVendorStatement",
        "summary": "Changes a vendor statement.",
        "description": "Changes a vendor statement. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorStatementId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "seenRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "vendorId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "basis": {
                    "type": "string",
                    "enum": [
                      "OPEN_ITEMS",
                      "ACTIVITY"
                    ]
                  },
                  "periodFrom": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "statementDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "openingMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "closingMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "statementNumber": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "seenRevision"
                ],
                "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/CreateVendorStatementResponse"
                }
              }
            }
          },
          "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/vendor-statements/{vendorStatementId}/accept": {
      "post": {
        "operationId": "acceptVendorStatement",
        "summary": "Accepts a vendor statement as reconciled.",
        "description": "Accepts a vendor statement as reconciled. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorStatementId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "seenRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "reconciliationDigest": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "supplierNameConfirmed": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "seenRevision",
                  "reconciliationDigest"
                ],
                "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/CreateVendorStatementResponse"
                }
              }
            }
          },
          "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/vendor-statements/{vendorStatementId}/discard": {
      "post": {
        "operationId": "discardVendorStatement",
        "summary": "Discards a vendor statement.",
        "description": "Discards a vendor statement. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorStatementId",
            "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": 8,
                    "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/Statement2"
                }
              }
            }
          },
          "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/vendor-statements/{vendorStatementId}/lines": {
      "put": {
        "operationId": "replaceVendorStatementLines",
        "summary": "Replaces the lines of a vendor statement.",
        "description": "Replaces the lines of a vendor statement. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorStatementId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "seenRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "lines": {
                    "maxItems": 2000,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "lineKind": {
                          "type": "string",
                          "enum": [
                            "INVOICE",
                            "CREDIT",
                            "PAYMENT",
                            "OTHER"
                          ]
                        },
                        "reference": {
                          "type": "string",
                          "maxLength": 100
                        },
                        "docDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "dueDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "amountMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "taxMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "excerpt": {
                          "type": "string",
                          "maxLength": 300
                        },
                        "confirmFigure": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "lineKind",
                        "amountMinor"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "seenRevision",
                  "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"
              },
              "Ledger-Position": {
                "$ref": "#/components/headers/LedgerPosition"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateVendorStatementResponse"
                }
              }
            }
          },
          "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/vendor-statements/{vendorStatementId}/lines/{lineId}/candidates": {
      "get": {
        "operationId": "listVendorStatementLineCandidates",
        "summary": "Lists the bills and payments a statement line may match.",
        "description": "Lists the bills and payments a statement line may match. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorStatementId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lineId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "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": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "BILL",
                              "CREDIT",
                              "PAYMENT"
                            ]
                          },
                          "id": {
                            "type": "string"
                          },
                          "number": {
                            "type": "string"
                          },
                          "date": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "status": {
                            "type": "string"
                          },
                          "available": {
                            "type": "boolean"
                          },
                          "why": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "kind",
                          "id",
                          "number",
                          "date",
                          "amountMinor",
                          "currency",
                          "status",
                          "available",
                          "why"
                        ],
                        "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/vendor-statements/{vendorStatementId}/lines/{lineId}/decline": {
      "post": {
        "operationId": "declineVendorStatementMatch",
        "summary": "Declines a suggested match for a vendor statement line.",
        "description": "Declines a suggested match for a vendor statement line. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorStatementId",
            "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": {
                  "seenRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 300
                  }
                },
                "required": [
                  "seenRevision",
                  "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/CreateVendorStatementResponse"
                }
              }
            }
          },
          "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/vendor-statements/{vendorStatementId}/lines/{lineId}/link": {
      "post": {
        "operationId": "linkVendorStatementLine",
        "summary": "Links a statement line to the bill or payment it describes.",
        "description": "Links a statement line to the bill or payment it describes. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorStatementId",
            "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": {
                  "seenRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "billId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "vendorCreditId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "paymentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "billSettlementId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "seenRevision"
                ],
                "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/CreateVendorStatementResponse"
                }
              }
            }
          },
          "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/vendor-statements/{vendorStatementId}/lines/{lineId}/unlink": {
      "post": {
        "operationId": "unlinkVendorStatementLine",
        "summary": "Removes the link between a statement line and its bill or payment.",
        "description": "Removes the link between a statement line and its bill or payment. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorStatementId",
            "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": {
                  "seenRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "seenRevision"
                ],
                "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/CreateVendorStatementResponse"
                }
              }
            }
          },
          "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/vendor-statements/{vendorStatementId}/notice-facts": {
      "get": {
        "operationId": "getVendorStatementNoticeFacts",
        "summary": "Returns the facts a notice about a vendor statement is built from.",
        "description": "Returns the facts a notice about a vendor statement is built from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorStatementId",
            "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/GetVendorStatementNoticeFactsResponse"
                }
              }
            }
          },
          "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/vendor-statements/{vendorStatementId}/notices": {
      "post": {
        "operationId": "draftVendorStatementNotice",
        "summary": "Drafts a notice to a vendor about their statement.",
        "description": "Drafts a notice to a vendor about their statement. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorStatementId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recipientEmail": {
                    "type": "string",
                    "maxLength": 320,
                    "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,}$"
                  },
                  "sentence": {
                    "$ref": "#/components/schemas/Sentence"
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "en",
                      "fr"
                    ]
                  }
                },
                "required": [
                  "recipientEmail"
                ],
                "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/DraftBankingNoticeResponse"
                }
              }
            }
          },
          "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/vendor-statements/{vendorStatementId}/read-again": {
      "post": {
        "operationId": "readVendorStatementAgain",
        "summary": "Reads a vendor statement again after it was corrected.",
        "description": "Reads a vendor statement again after it was corrected. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorStatementId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "seenRevision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "replaceEdits": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "seenRevision",
                  "replaceEdits"
                ],
                "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/CreateVendorStatementResponse"
                }
              }
            }
          },
          "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/vendor-statements/{vendorStatementId}/recheck": {
      "get": {
        "operationId": "recheckVendorStatement",
        "summary": "Rechecks a vendor statement against the ledger.",
        "description": "Rechecks a vendor statement against the ledger. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorStatementId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "column",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "both",
                "different",
                "theirs",
                "ours"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "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": {
                  "$ref": "#/components/schemas/Rows2"
                }
              }
            }
          },
          "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/vendor-statements/{vendorStatementId}/rows": {
      "get": {
        "operationId": "listVendorStatementRows",
        "summary": "Lists the rows of one vendor statement.",
        "description": "Lists the rows of one vendor statement. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorStatementId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "column",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "both",
                "different",
                "theirs",
                "ours"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "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": {
                  "$ref": "#/components/schemas/Rows2"
                }
              }
            }
          },
          "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/vendors": {
      "get": {
        "operationId": "listVendors",
        "summary": "Lists the vendors on the ledger, with the server's total.",
        "description": "Lists the vendors on the ledger, with the server's total. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "ARCHIVED"
              ]
            }
          },
          {
            "name": "bankingPending",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "paymentHold",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "money",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "notice",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "owed"
              ]
            }
          },
          {
            "name": "acceptance",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PENDING_ACCEPTANCE",
                "ACCEPTED",
                "REFUSED",
                "NOT_REVIEWED"
              ]
            }
          },
          {
            "name": "handoff",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "notTold"
              ]
            }
          },
          {
            "name": "bankingAwaiting",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "myVerification"
              ]
            }
          },
          {
            "name": "registration",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "unconfirmed"
              ]
            }
          },
          {
            "name": "paper",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "notCurrent",
                "expiring"
              ]
            }
          },
          {
            "name": "portal",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "waiting"
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "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/ListVendorsResponseItem"
                      }
                    },
                    "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": "createVendor",
        "summary": "Creates a vendor on the ledger.",
        "description": "Creates a vendor on the ledger. Needs the `ledger:propose` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "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
                  },
                  "taxNumber": {
                    "type": "string",
                    "pattern": "^[0-9]{9}RT[0-9]{4}$"
                  },
                  "slipKind": {
                    "default": "NONE",
                    "type": "string",
                    "enum": [
                      "NONE",
                      "T4A",
                      "T5018",
                      "T4A_NR"
                    ]
                  },
                  "defaultAccountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "paymentTermsId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "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,}$"
                  },
                  "phone": {
                    "type": "string",
                    "maxLength": 50
                  },
                  "address": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "recipientType": {
                    "type": "string",
                    "enum": [
                      "INDIVIDUAL",
                      "CORPORATION",
                      "PARTNERSHIP"
                    ]
                  },
                  "surname": {
                    "type": "string",
                    "maxLength": 20
                  },
                  "givenName": {
                    "type": "string",
                    "maxLength": 12
                  },
                  "addressLine1": {
                    "type": "string",
                    "maxLength": 30
                  },
                  "addressLine2": {
                    "type": "string",
                    "maxLength": 30
                  },
                  "city": {
                    "type": "string",
                    "maxLength": 28
                  },
                  "region": {
                    "type": "string",
                    "pattern": "^[A-Z]{2}-[A-Z0-9]{1,3}$"
                  },
                  "postalCode": {
                    "type": "string",
                    "pattern": "^[A-Z0-9 ]{1,10}$"
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Z]{2}$"
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "defaultCurrency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "en",
                      "fr"
                    ]
                  },
                  "qstNumber": {
                    "type": "string",
                    "maxLength": 32,
                    "pattern": "^[0-9]{10}TQ[0-9]{4}$"
                  },
                  "gstRegistrationState": {
                    "default": "UNKNOWN",
                    "type": "string",
                    "enum": [
                      "REGISTERED",
                      "NOT_REGISTERED",
                      "UNKNOWN"
                    ]
                  },
                  "residency": {
                    "default": "UNKNOWN",
                    "type": "string",
                    "enum": [
                      "CANADA",
                      "NON_RESIDENT",
                      "UNKNOWN"
                    ]
                  },
                  "contacts": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ContactsItem"
                    }
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields3"
                  }
                },
                "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/CreateVendorResponse"
                }
              }
            }
          },
          "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/vendors/bulk/payment-hold": {
      "post": {
        "operationId": "bulkHoldVendorPayments",
        "summary": "Puts the payments to several vendors on hold in one request.",
        "description": "Puts the payments to several vendors on hold in one request. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkHoldVendorPaymentsRequest"
              }
            }
          }
        },
        "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/BulkHoldVendorPaymentsResponse"
                }
              }
            }
          },
          "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/vendors/bulk/payment-hold/release": {
      "post": {
        "operationId": "bulkReleaseVendorHolds",
        "summary": "Releases the payment holds on several vendors in one request.",
        "description": "Releases the payment holds on several vendors in one request. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkHoldVendorPaymentsRequest"
              }
            }
          }
        },
        "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/BulkHoldVendorPaymentsResponse"
                }
              }
            }
          },
          "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/vendors/provider-links": {
      "post": {
        "operationId": "linkVendorPairs",
        "summary": "Links vendors that are the same supplier in two systems.",
        "description": "Links vendors that are the same supplier in two systems. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "QBO",
                      "XERO"
                    ]
                  },
                  "connectionId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "pairs": {
                    "minItems": 1,
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "vendorId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "externalId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        },
                        "externalLabel": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255
                        }
                      },
                      "required": [
                        "vendorId",
                        "externalId",
                        "externalLabel"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "provider",
                  "pairs"
                ],
                "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": {
                    "linked": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "linked"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/vendors/review": {
      "get": {
        "operationId": "listVendorsForReview",
        "summary": "Lists the vendors waiting for a person to review them.",
        "description": "Lists the vendors waiting for a person to review them. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NOT_REVIEWED",
                "PENDING_ACCEPTANCE",
                "REFUSED"
              ]
            }
          },
          {
            "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": {
                    "rows": {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "vendor": {
                                "$ref": "#/components/schemas/ListVendorsResponseItem"
                              },
                              "paid": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "currency": {
                                      "type": "string",
                                      "pattern": "^[A-Z]{3}$"
                                    },
                                    "paidMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    }
                                  },
                                  "required": [
                                    "currency",
                                    "paidMinor"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "paymentCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "vendor",
                              "paid",
                              "paymentCount"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "data",
                        "nextCursor",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "ranked": {
                      "type": "boolean"
                    },
                    "awaitingAcceptance": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "notReviewed": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "rows",
                    "ranked",
                    "awaitingAcceptance",
                    "notReviewed"
                  ],
                  "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/vendors/{vendorId}": {
      "get": {
        "operationId": "getVendor",
        "summary": "Returns one vendor with its terms, contacts and status.",
        "description": "Returns one vendor with its terms, contacts and status. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "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
            }
          },
          {
            "name": "coordinates",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "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": {
                  "$ref": "#/components/schemas/CreateVendorResponse"
                }
              }
            }
          },
          "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": "updateVendor",
        "summary": "Changes a vendor's details or terms.",
        "description": "Changes a vendor's details or terms. Needs the `ledger:propose` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "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"
                      }
                    ]
                  },
                  "email": {
                    "$ref": "#/components/schemas/Email"
                  },
                  "phone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 50
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "address": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "addressLine1": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 30
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "addressLine2": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 30
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "city": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 28
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "region": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{2}-[A-Z0-9]{1,3}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "postalCode": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z0-9 ]{1,10}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "country": {
                    "type": "string",
                    "pattern": "^[A-Z]{2}$"
                  },
                  "notes": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "defaultCurrency": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "en",
                      "fr"
                    ]
                  },
                  "customFields": {
                    "$ref": "#/components/schemas/CustomFields4"
                  }
                },
                "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/ListVendorsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/accept": {
      "post": {
        "operationId": "acceptVendor",
        "summary": "Accepts a vendor onto the ledger after its details are checked.",
        "description": "Accepts a vendor onto the ledger after its details are checked. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "duplicatesShown": {
                    "default": [],
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "similarNameShown": {
                    "default": false,
                    "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": {
                  "$ref": "#/components/schemas/ListVendorsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/account-statement": {
      "get": {
        "operationId": "getVendorAccountStatement",
        "summary": "Returns the account statement the ledger holds for a vendor.",
        "description": "Returns the account statement the ledger holds for a vendor. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "asAt",
            "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": {
                    "vendor": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "displayName"
                      ],
                      "additionalProperties": false
                    },
                    "company": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "asAt": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "BILL",
                              "CREDIT"
                            ]
                          },
                          "id": {
                            "type": "string"
                          },
                          "number": {
                            "type": "string"
                          },
                          "billDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "dueDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "bookedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "openMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "column": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind",
                          "id",
                          "number",
                          "billDate",
                          "dueDate",
                          "bookedMinor",
                          "openMinor",
                          "column"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "payments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "reference": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "method": {
                            "type": "string"
                          },
                          "billNumbers": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "date",
                          "amountMinor",
                          "reference",
                          "method",
                          "billNumbers"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "ageing": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "column": {
                            "type": "string"
                          },
                          "minor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          }
                        },
                        "required": [
                          "column",
                          "minor"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "closingMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "ties": {
                      "type": "boolean",
                      "const": true
                    },
                    "supplierAgeingMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "rowCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "vendor",
                    "company",
                    "currency",
                    "asAt",
                    "rows",
                    "payments",
                    "ageing",
                    "closingMinor",
                    "ties",
                    "supplierAgeingMinor",
                    "rowCount",
                    "entityTimeZone"
                  ],
                  "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/vendors/{vendorId}/account-statement/notice-facts": {
      "get": {
        "operationId": "getVendorAccountStatementNoticeFacts",
        "summary": "Returns the facts a notice about a vendor's account statement is built from.",
        "description": "Returns the facts a notice about a vendor's account statement is built from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          {
            "name": "asAt",
            "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": {
                  "$ref": "#/components/schemas/GetVendorStatementNoticeFactsResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/account-statement/notices": {
      "post": {
        "operationId": "draftVendorAccountStatement",
        "summary": "Drafts a notice that sends a vendor their account statement.",
        "description": "Drafts a notice that sends a vendor their account statement. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "asAt": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "recipientEmail": {
                    "type": "string",
                    "maxLength": 320,
                    "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,}$"
                  },
                  "sentence": {
                    "$ref": "#/components/schemas/Sentence"
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "en",
                      "fr"
                    ]
                  }
                },
                "required": [
                  "entityId",
                  "currency",
                  "asAt",
                  "recipientEmail"
                ],
                "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/DraftBankingNoticeResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/agreements": {
      "get": {
        "operationId": "listVendorAgreements",
        "summary": "Lists the agreements held with a vendor.",
        "description": "Lists the agreements held with a vendor. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "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
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "UPCOMING",
                "ACTIVE",
                "ACT_SOON",
                "ACT_BY_PASSED",
                "TERM_PASSED",
                "RENEWED",
                "ENDED"
              ]
            }
          },
          {
            "name": "entityId",
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListVendorAgreementsResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "entityTimeZone"
                  ],
                  "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": "recordVendorAgreement",
        "summary": "Records an agreement with a vendor.",
        "description": "Records an agreement with a vendor. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "startsOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "endsOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "renewal": {
                    "type": "string",
                    "enum": [
                      "AUTO_RENEWS",
                      "ENDS",
                      "OPEN_ENDED"
                    ]
                  },
                  "noticeDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 730
                  },
                  "committedAmount": {
                    "$ref": "#/components/schemas/CommittedOption1"
                  },
                  "accountId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "vendorDocumentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "ownerUserId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "renewsAgreementId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "entityId",
                  "name",
                  "startsOn",
                  "renewal",
                  "ownerUserId"
                ],
                "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/ListVendorAgreementsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/agreements/{agreementId}/decide": {
      "post": {
        "operationId": "decideVendorAgreement",
        "summary": "Approves or declines an agreement with a vendor.",
        "description": "Approves or declines an agreement with a vendor. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "agreementId",
            "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": [
                      "RENEW",
                      "LET_END"
                    ]
                  },
                  "note": {
                    "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/ListVendorAgreementsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/agreements/{agreementId}/end": {
      "post": {
        "operationId": "endVendorAgreement",
        "summary": "Ends an agreement with a vendor.",
        "description": "Ends an agreement with a vendor. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "agreementId",
            "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": 4,
                    "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/ListVendorAgreementsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/aliases": {
      "get": {
        "operationId": "listVendorAliases",
        "summary": "Lists the names a vendor is known by.",
        "description": "Lists the names a vendor is known by. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "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": {
                        "$ref": "#/components/schemas/ListVendorAliasesResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "entityTimeZone"
                  ],
                  "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": "addVendorAlias",
        "summary": "Adds a name a vendor is known by.",
        "description": "Adds a name a vendor is known by. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "alias": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "alias"
                ],
                "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/ListVendorAliasesResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/archive": {
      "post": {
        "operationId": "archiveVendor",
        "summary": "Archives a vendor so no new bills can be raised against it.",
        "description": "Archives a vendor so no new bills can be raised against it. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "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/ListVendorsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/audit": {
      "get": {
        "operationId": "listVendorAudit",
        "summary": "Lists the audit trail of one vendor.",
        "description": "Lists the audit trail of one vendor. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "action",
            "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/vendors/{vendorId}/banking/{changeId}/brief": {
      "get": {
        "operationId": "getBankingChangeBrief",
        "summary": "Returns the brief a person reads before verifying a banking change.",
        "description": "Returns the brief a person reads before verifying a banking change. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "changeId",
            "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": {
                    "changeId": {
                      "type": "string"
                    },
                    "vendorId": {
                      "type": "string"
                    },
                    "computedAt": {
                      "type": "string",
                      "minLength": 20
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "signals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "$ref": "#/components/schemas/Kind3"
                          },
                          "label": {
                            "type": "string"
                          },
                          "sentence": {
                            "type": "string"
                          },
                          "stored": {
                            "$ref": "#/components/schemas/Stored"
                          },
                          "cameUpAfterProposal": {
                            "type": "boolean"
                          },
                          "confirmedBefore": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "kind",
                          "label",
                          "sentence",
                          "stored",
                          "cameUpAfterProposal",
                          "confirmedBefore"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "suppressions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "$ref": "#/components/schemas/Kind3"
                          },
                          "code": {
                            "type": "string",
                            "enum": [
                              "NO_PRIORS",
                              "OTHER_CURRENCY",
                              "FIRST_CHANGE"
                            ]
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind",
                          "code",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "priorsExamined": {
                      "type": "object",
                      "properties": {
                        "knownDomains": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "earlierChanges": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "unpaidBillsRead": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "messagesRead": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "knownDomains",
                        "earlierChanges",
                        "unpaidBillsRead",
                        "messagesRead"
                      ],
                      "additionalProperties": false
                    },
                    "printedOn": {
                      "maxItems": 5,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "billId": {
                            "type": "string"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "receivedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "domain": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "standing": {
                            "type": "string",
                            "enum": [
                              "KNOWN",
                              "RETIRED",
                              "FIRST_TIME",
                              "NO_PRIORS",
                              "NO_VENDOR",
                              "NOT_MAILED",
                              "NOT_CHECKED"
                            ]
                          }
                        },
                        "required": [
                          "billId",
                          "number",
                          "receivedAt",
                          "domain",
                          "standing"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "printedOnTotal": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "related": {
                      "maxItems": 10,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/StoredOption1"
                      }
                    },
                    "relatedTotal": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "history": {
                      "type": "object",
                      "properties": {
                        "earlierChanges": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "sameAccountRefusedBefore": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "changeId": {
                                  "type": "string"
                                },
                                "decidedAt": {
                                  "type": "string",
                                  "minLength": 20
                                },
                                "byName": {
                                  "type": "string"
                                },
                                "reason": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "changeId",
                                "decidedAt",
                                "byName",
                                "reason"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "earlierChanges",
                        "sameAccountRefusedBefore"
                      ],
                      "additionalProperties": false
                    },
                    "callback": {
                      "type": "object",
                      "properties": {
                        "numbers": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "number": {
                                "type": "string"
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "VENDOR_PHONE",
                                  "CONTACT"
                                ]
                              },
                              "label": {
                                "type": "string"
                              },
                              "onFileSince": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "number",
                              "source",
                              "label",
                              "onFileSince"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "addedAfter": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "number": {
                                "type": "string"
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "VENDOR_PHONE",
                                  "CONTACT"
                                ]
                              },
                              "label": {
                                "type": "string"
                              },
                              "changedAt": {
                                "type": "string",
                                "minLength": 20
                              }
                            },
                            "required": [
                              "number",
                              "source",
                              "label",
                              "changedAt"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "none": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "numbers",
                        "addedAfter",
                        "none"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "changeId",
                    "vendorId",
                    "computedAt",
                    "entityTimeZone",
                    "signals",
                    "suppressions",
                    "priorsExamined",
                    "printedOn",
                    "printedOnTotal",
                    "related",
                    "relatedTotal",
                    "history",
                    "callback"
                  ],
                  "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/vendors/{vendorId}/banking/{changeId}/evidence-read": {
      "post": {
        "operationId": "readBankingEvidence",
        "summary": "Reads the evidence a vendor's banking change arrived with.",
        "description": "Reads the evidence a vendor's banking change arrived with. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "changeId",
            "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": {
                    "read": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "documentKind": {
                              "type": "string",
                              "enum": [
                                "VOID_CHEQUE",
                                "BANK_LETTER",
                                "STATEMENT",
                                "OTHER"
                              ]
                            },
                            "holderNamePrinted": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "namesTheSupplier": {
                              "type": "boolean"
                            },
                            "documentDate": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "legible": {
                              "type": "boolean"
                            },
                            "routing": {
                              "type": "string",
                              "enum": [
                                "AGREES",
                                "DIFFERS",
                                "NOT_FOUND"
                              ]
                            },
                            "holderName": {
                              "type": "string",
                              "enum": [
                                "AGREES",
                                "DIFFERS",
                                "NOT_FOUND"
                              ]
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "documentKind",
                            "holderNamePrinted",
                            "namesTheSupplier",
                            "documentDate",
                            "legible",
                            "routing",
                            "holderName",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "type": "string",
                      "enum": [
                        "NO_EVIDENCE",
                        "UNREADABLE",
                        "DISCLOSURE",
                        "BUDGET",
                        "PROVIDER",
                        "UNPARSABLE",
                        "REFUSED"
                      ]
                    }
                  },
                  "required": [
                    "read"
                  ],
                  "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/vendors/{vendorId}/banking/{changeId}/notice": {
      "post": {
        "operationId": "draftBankingNotice",
        "summary": "Drafts the notice that tells a vendor their banking details changed.",
        "description": "Drafts the notice that tells a vendor their banking details changed. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "changeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recipientEmail": {
                    "type": "string",
                    "maxLength": 320,
                    "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,}$"
                  }
                },
                "required": [
                  "recipientEmail"
                ],
                "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/DraftBankingNoticeResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/banking/{changeId}/notice-sent": {
      "post": {
        "operationId": "markBankingNoticeSent",
        "summary": "Records that the notice of a vendor's banking change was sent.",
        "description": "Records that the notice of a vendor's banking change was sent. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "changeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recipient": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 320
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "recipient"
                ],
                "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/ListVendorsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/banking/{changeId}/reject": {
      "post": {
        "operationId": "rejectBankingChange",
        "summary": "Rejects a proposed change to a vendor's banking details.",
        "description": "Rejects a proposed change to a vendor's banking details. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "changeId",
            "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
                  },
                  "becauseOf": {
                    "default": [],
                    "maxItems": 6,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "HOLDER_NAME_MISMATCH",
                        "NO_EVIDENCE",
                        "NEW_SENDER_DOMAIN",
                        "CHANGE_BEFORE_A_LARGE_BILL",
                        "SHORT_INTERVAL",
                        "SHARED_ACCOUNT"
                      ]
                    }
                  }
                },
                "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/ListVendorsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/banking/{changeId}/withdraw": {
      "post": {
        "operationId": "withdrawBankingChange",
        "summary": "Withdraws a proposed change to a vendor's banking details.",
        "description": "Withdraws a proposed change to a vendor's banking details. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "changeId",
            "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/ListVendorsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/contacts": {
      "post": {
        "operationId": "addVendorContact",
        "summary": "Adds a contact person to a vendor.",
        "description": "Adds a contact person to a vendor. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactsItem"
              }
            }
          }
        },
        "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/AddVendorContactResponse"
                }
              }
            }
          },
          "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"
          }
        }
      },
      "get": {
        "operationId": "listVendorContacts",
        "summary": "Lists the contacts of a vendor.",
        "description": "Lists the contacts of a vendor. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "withEmail",
            "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": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "email": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "role": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "hasLiveLink": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "email",
                          "role",
                          "hasLiveLink"
                        ],
                        "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/vendors/{vendorId}/contacts/{contactId}": {
      "patch": {
        "operationId": "updateVendorContact",
        "summary": "Changes a vendor contact's details.",
        "description": "Changes a vendor contact's details. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contactId",
            "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": 120
                  },
                  "email": {
                    "$ref": "#/components/schemas/Email"
                  },
                  "phone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 50
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "BILLING",
                      "ACCOUNT_MANAGER",
                      "ESCALATION",
                      "REMITTANCE"
                    ]
                  },
                  "note": {
                    "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": {
                  "$ref": "#/components/schemas/AddVendorContactResponse"
                }
              }
            }
          },
          "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": "removeVendorContact",
        "summary": "Removes a contact person from a vendor.",
        "description": "Removes a contact person from a vendor. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contactId",
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AddVendorContactResponse"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total"
                  ],
                  "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/vendors/{vendorId}/contacts/{contactId}/slip-consent": {
      "post": {
        "operationId": "recordSlipConsent",
        "summary": "Records a vendor contact's consent to receive slips electronically.",
        "description": "Records a vendor contact's consent to receive slips electronically. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contactId",
            "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": [
                      "WRITTEN",
                      "ELECTRONIC"
                    ]
                  },
                  "givenOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "note": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 500
                  }
                },
                "required": [
                  "basis",
                  "givenOn",
                  "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/AddVendorContactResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/contacts/{contactId}/slip-consent/withdraw": {
      "post": {
        "operationId": "withdrawSlipConsent",
        "summary": "Withdraws a vendor contact's consent to receive slips electronically.",
        "description": "Withdraws a vendor contact's consent to receive slips electronically. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contactId",
            "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": 4,
                    "maxLength": 280
                  }
                },
                "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/AddVendorContactResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/destroyable-banking": {
      "get": {
        "operationId": "listDestroyableBanking",
        "summary": "Lists the banking details of a vendor that may be destroyed.",
        "description": "Lists the banking details of a vendor that may be destroyed. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "vendorId",
            "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": {
                    "changes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "changeId": {
                            "type": "string"
                          },
                          "scheme": {
                            "type": "string"
                          },
                          "accountNumberLast4": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "verifiedOn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "replacedOn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "paymentCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "lastPaidOn": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "bankFileCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "changeId",
                          "scheme",
                          "accountNumberLast4",
                          "verifiedOn",
                          "replacedOn",
                          "paymentCount",
                          "lastPaidOn",
                          "bankFileCount"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "changes"
                  ],
                  "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/vendors/{vendorId}/documents": {
      "get": {
        "operationId": "listVendorDocuments",
        "summary": "Lists the documents held for a vendor.",
        "description": "Lists the documents held for a vendor. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "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
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "schema": {
              "default": "live",
              "type": "string",
              "enum": [
                "live",
                "history"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "WSIB_CLEARANCE",
                "INSURANCE_CERTIFICATE",
                "MASTER_AGREEMENT",
                "W8BEN",
                "DIRECT_DEPOSIT_FORM",
                "WITHHOLDING_WAIVER",
                "OTHER"
              ]
            }
          },
          {
            "name": "withoutTerms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "entityId",
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListVendorDocumentsResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "standing": {
                      "$ref": "#/components/schemas/Standing"
                    },
                    "live": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 200
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "standing",
                    "live",
                    "entityTimeZone"
                  ],
                  "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": "recordVendorDocument",
        "summary": "Records a document held for a vendor.",
        "description": "Records a document held for a vendor. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "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
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "WSIB_CLEARANCE",
                      "INSURANCE_CERTIFICATE",
                      "MASTER_AGREEMENT",
                      "W8BEN",
                      "DIRECT_DEPOSIT_FORM",
                      "WITHHOLDING_WAIVER",
                      "OTHER"
                    ]
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "reference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "validFrom": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "validUntil": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "replacesDocumentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "reading": {
                    "type": "object",
                    "properties": {
                      "promptVersion": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "kindAgrees": {
                        "type": "boolean"
                      },
                      "validFromRead": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "validUntilRead": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "promptVersion",
                      "kindAgrees",
                      "validFromRead",
                      "validUntilRead"
                    ],
                    "additionalProperties": false
                  },
                  "portalSubmissionId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "documentId",
                  "kind"
                ],
                "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/ListVendorDocumentsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/documents/read": {
      "post": {
        "operationId": "readVendorPaper",
        "summary": "Reads the paper a vendor provided, such as a W-9 or a contract.",
        "description": "Reads the paper a vendor provided, such as a W-9 or a contract. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "WSIB_CLEARANCE",
                      "INSURANCE_CERTIFICATE",
                      "MASTER_AGREEMENT",
                      "W8BEN",
                      "DIRECT_DEPOSIT_FORM",
                      "WITHHOLDING_WAIVER",
                      "OTHER"
                    ]
                  }
                },
                "required": [
                  "documentId",
                  "kind"
                ],
                "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": {
                    "read": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "promptVersion": {
                              "type": "string"
                            },
                            "kindAgrees": {
                              "type": "boolean"
                            },
                            "pageKind": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "WSIB_CLEARANCE",
                                    "INSURANCE_CERTIFICATE",
                                    "MASTER_AGREEMENT",
                                    "W8BEN",
                                    "DIRECT_DEPOSIT_FORM",
                                    "WITHHOLDING_WAIVER",
                                    "OTHER"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "validFrom": {
                              "$ref": "#/components/schemas/ValidFrom"
                            },
                            "validUntil": {
                              "$ref": "#/components/schemas/ValidFrom"
                            }
                          },
                          "required": [
                            "promptVersion",
                            "kindAgrees",
                            "pageKind",
                            "validFrom",
                            "validUntil"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNPARSABLE",
                            "REFUSED",
                            "UNREADABLE",
                            "SENSITIVE_KIND",
                            "PAUSED_AFTER_THREE_EDITED"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "pausedUntil": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "read",
                    "why",
                    "pausedUntil"
                  ],
                  "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/vendors/{vendorId}/documents/{documentId}/withdraw": {
      "post": {
        "operationId": "withdrawVendorDocument",
        "summary": "Withdraws a document held for a vendor.",
        "description": "Withdraws a document held for a vendor. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "documentId",
            "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": 4,
                    "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/ListVendorDocumentsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/duplicate-brief": {
      "post": {
        "operationId": "draftVendorDuplicateBrief",
        "summary": "Drafts the brief a person reads to decide whether two vendors are the same.",
        "description": "Drafts the brief a person reads to decide whether two vendors are the same. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "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/DraftVendorDuplicateBriefResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/handoff-facts": {
      "get": {
        "operationId": "getHandoffFacts",
        "summary": "Returns the facts a handoff notice to a vendor's contact is built from.",
        "description": "Returns the facts a handoff notice to a vendor's contact is built from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "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": {
                  "type": "object",
                  "properties": {
                    "vendor": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        },
                        "language": {
                          "type": "string",
                          "enum": [
                            "en",
                            "fr"
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "ACTIVE",
                            "ARCHIVED"
                          ]
                        },
                        "acceptanceState": {
                          "type": "string",
                          "enum": [
                            "PENDING_ACCEPTANCE",
                            "ACCEPTED",
                            "REFUSED",
                            "NOT_REVIEWED"
                          ]
                        },
                        "paymentTermsName": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "displayName",
                        "language",
                        "status",
                        "acceptanceState",
                        "paymentTermsName"
                      ],
                      "additionalProperties": false
                    },
                    "entity": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "billTo": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "timeZone": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "billTo",
                        "timeZone"
                      ],
                      "additionalProperties": false
                    },
                    "addresses": {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "address": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "boundToThisVendor": {
                                "type": "boolean"
                              },
                              "watcher": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              "watcherEmail": {
                                "type": "string"
                              },
                              "contact": {
                                "$ref": "#/components/schemas/Contact"
                              }
                            },
                            "required": [
                              "id",
                              "address",
                              "label",
                              "boundToThisVendor",
                              "watcher",
                              "watcherEmail",
                              "contact"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "nextCursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "total": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "data",
                        "nextCursor",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "recipients": {
                      "$ref": "#/components/schemas/Recipients"
                    },
                    "situation": {
                      "type": "string",
                      "enum": [
                        "NEW_SUPPLIER",
                        "NOT_USING_AN_INBOX",
                        "ALREADY_USING_AN_INBOX"
                      ]
                    },
                    "billCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "inboxBillCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "lastTold": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "at": {
                              "type": "string",
                              "minLength": 20
                            },
                            "by": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "recipientEmail": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "at",
                            "by",
                            "recipientEmail"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "openDrafts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "noticeId": {
                            "type": "string"
                          },
                          "recipientEmail": {
                            "type": "string"
                          },
                          "inboundAddressId": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "createdBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "noticeId",
                          "recipientEmail",
                          "inboundAddressId",
                          "createdAt",
                          "createdBy"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "outboundApproved": {
                      "type": "boolean"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "vendor",
                    "entity",
                    "addresses",
                    "recipients",
                    "situation",
                    "billCount",
                    "inboxBillCount",
                    "lastTold",
                    "openDrafts",
                    "outboundApproved",
                    "entityTimeZone"
                  ],
                  "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/vendors/{vendorId}/handoff-paragraph": {
      "post": {
        "operationId": "draftHandoffParagraph",
        "summary": "Drafts the paragraph a handoff notice carries for one vendor.",
        "description": "Drafts the paragraph a handoff notice carries for one vendor. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "note": {
                    "default": "",
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "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"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "drafted": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "why": {
                      "type": "string",
                      "enum": [
                        "DISCLOSURE",
                        "BUDGET",
                        "PROVIDER",
                        "UNPARSABLE",
                        "REFUSED",
                        "FIGURE_INVENTED",
                        "CONTACT_DETAIL",
                        "BANKING_WORDS",
                        "PAUSED_AFTER_THREE_UNUSED"
                      ]
                    },
                    "promptVersion": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resumesOn": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    }
                  },
                  "required": [
                    "drafted",
                    "promptVersion"
                  ],
                  "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/vendors/{vendorId}/handoffs": {
      "post": {
        "operationId": "createHandoff",
        "summary": "Creates a handoff notice that passes a vendor's open items to its contact.",
        "description": "Creates a handoff notice that passes a vendor's open items to its contact. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "inboundAddressId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "recipientEmail": {
                    "type": "string",
                    "maxLength": 320,
                    "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,}$"
                  },
                  "paragraph": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 600
                  },
                  "paragraphSource": {
                    "type": "string",
                    "enum": [
                      "STANDARD",
                      "AGENT_DRAFT",
                      "AGENT_DRAFT_EDITED",
                      "PERSON"
                    ]
                  },
                  "promptVersion": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "draftRequested": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "entityId",
                  "inboundAddressId",
                  "recipientEmail",
                  "paragraph",
                  "paragraphSource"
                ],
                "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/CreateHandoffResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/handoffs/{noticeId}/discard": {
      "post": {
        "operationId": "discardHandoff",
        "summary": "Discards a handoff notice that has not been sent.",
        "description": "Discards a handoff notice that has not been sent. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "noticeId",
            "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/CreateHandoffResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/handoffs/{noticeId}/sent": {
      "post": {
        "operationId": "recordHandoffSent",
        "summary": "Records that a handoff notice was sent outside the product.",
        "description": "Records that a handoff notice was sent outside the product. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "noticeId",
            "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/CreateHandoffResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/history": {
      "get": {
        "operationId": "listVendorHistory",
        "summary": "Lists the history of a vendor, newest first.",
        "description": "Lists the history of a vendor, newest first. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "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
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PAID_BILL",
                "VENDOR_PAYMENT"
              ]
            }
          },
          {
            "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": {
                    "data": {
                      "$ref": "#/components/schemas/ListImportedHistoryResponse"
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "entityTimeZone"
                  ],
                  "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/vendors/{vendorId}/hold-brief": {
      "post": {
        "operationId": "draftVendorHoldReason",
        "summary": "Drafts the reason for a payment hold on a vendor.",
        "description": "Drafts the reason for a payment hold on a vendor. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "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"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftVendorHoldReasonResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/line-profile": {
      "get": {
        "operationId": "getVendorLineProfile",
        "summary": "Returns the line profile of a vendor, which says how its bills are coded.",
        "description": "Returns the line profile of a vendor, which says how its bills are coded. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "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": {
                    "vendorId": {
                      "type": "string"
                    },
                    "vendorName": {
                      "type": "string"
                    },
                    "archived": {
                      "type": "boolean"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "agreement": {
                      "type": "number",
                      "const": 3
                    },
                    "lookbackDays": {
                      "type": "number",
                      "const": 400
                    },
                    "approvedInWindow": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "newest": {
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "billId": {
                            "type": "string"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "approvedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "entityId": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "billId",
                          "number",
                          "billDate",
                          "approvedAt",
                          "entityId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "fields": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "field": {
                            "type": "string",
                            "enum": [
                              "ACCOUNT",
                              "SUPPLY_CATEGORY",
                              "ITC_KIND",
                              "COMMERCIAL_USE",
                              "PROVINCIAL_SERVICE",
                              "PROPERTY_REGION",
                              "DIMENSION"
                            ]
                          },
                          "dimensionTypeId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "dimensionLabel": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "AGREED",
                              "NOT_OFFERED",
                              "COVERED",
                              "DECLINED"
                            ]
                          },
                          "valueLabel": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "why": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "TOO_FEW_BILLS",
                                  "TOO_OLD",
                                  "MIXED",
                                  "DIFFERS",
                                  "BLANK",
                                  "GENERAL_KIND",
                                  "FULL_USE",
                                  "NOT_REAL_PROPERTY"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "whyText": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "field",
                          "dimensionTypeId",
                          "dimensionLabel",
                          "state",
                          "valueLabel",
                          "why",
                          "whyText"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "suggestion": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "fields": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "ACCOUNT",
                                  "SUPPLY_CATEGORY",
                                  "ITC_KIND",
                                  "COMMERCIAL_USE",
                                  "PROVINCIAL_SERVICE",
                                  "PROPERTY_REGION",
                                  "DIMENSION"
                                ]
                              }
                            },
                            "replaces": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "ruleId": {
                                      "type": "string"
                                    },
                                    "authorName": {
                                      "type": "string"
                                    },
                                    "setOn": {
                                      "type": "string",
                                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                    }
                                  },
                                  "required": [
                                    "ruleId",
                                    "authorName",
                                    "setOn"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "fields",
                            "replaces"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "live": {
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/LiveOption1"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "waiting": {
                      "maxItems": 5,
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/LiveOption1"
                      }
                    },
                    "decided": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "maxItems": 10,
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/LiveOption1"
                          }
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "items",
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "corrections": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "maxItems": 5,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "BILL_CODING_CORRECTED",
                                  "BILL_DECLINED_WITH_FILLS"
                                ]
                              },
                              "billId": {
                                "type": "string"
                              },
                              "billNumber": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "at": {
                                "type": "string",
                                "minLength": 20
                              },
                              "byName": {
                                "type": "string"
                              },
                              "lines": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "description": {
                                      "type": "string"
                                    },
                                    "from": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "code": {
                                              "type": "string"
                                            },
                                            "name": {
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "code",
                                            "name"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "to": {
                                      "type": "object",
                                      "properties": {
                                        "code": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "code",
                                        "name"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "fromItcKind": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "enum": [
                                            "GENERAL",
                                            "MEALS_ENTERTAINMENT",
                                            "PASSENGER_VEHICLE",
                                            "ZERO_EMISSION_VEHICLE",
                                            "EXEMPT_ACTIVITY",
                                            "NONE"
                                          ]
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "toItcKind": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "enum": [
                                            "GENERAL",
                                            "MEALS_ENTERTAINMENT",
                                            "PASSENGER_VEHICLE",
                                            "ZERO_EMISSION_VEHICLE",
                                            "EXEMPT_ACTIVITY",
                                            "NONE"
                                          ]
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "description",
                                    "from",
                                    "to",
                                    "fromItcKind",
                                    "toItcKind"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "billId",
                              "billNumber",
                              "at",
                              "byName",
                              "lines"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "items",
                        "total"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "vendorId",
                    "vendorName",
                    "archived",
                    "entityTimeZone",
                    "agreement",
                    "lookbackDays",
                    "approvedInWindow",
                    "newest",
                    "fields",
                    "suggestion",
                    "live",
                    "waiting",
                    "decided",
                    "corrections"
                  ],
                  "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"
          }
        }
      },
      "post": {
        "operationId": "proposeVendorLineProfile",
        "summary": "Proposes the line profile of a vendor for a person to decide.",
        "description": "Proposes the line profile of a vendor for a person to decide. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fields": {
                    "minItems": 1,
                    "maxItems": 7,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "ACCOUNT",
                        "SUPPLY_CATEGORY",
                        "ITC_KIND",
                        "COMMERCIAL_USE",
                        "PROVINCIAL_SERVICE",
                        "PROPERTY_REGION",
                        "DIMENSION"
                      ]
                    }
                  },
                  "entityId": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "expiresOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "replacesRuleId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "fields",
                  "expiresOn"
                ],
                "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": {
                  "type": "object",
                  "properties": {
                    "rule": {
                      "$ref": "#/components/schemas/ListRulesResponseItem"
                    },
                    "preview": {
                      "$ref": "#/components/schemas/PreviewRuleResponse"
                    }
                  },
                  "required": [
                    "rule",
                    "preview"
                  ],
                  "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/vendors/{vendorId}/line-profile/dismiss": {
      "post": {
        "operationId": "dismissVendorLineProfile",
        "summary": "Dismisses a proposed line profile for a vendor.",
        "description": "Dismisses a proposed line profile for a vendor. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fields": {
                    "minItems": 1,
                    "maxItems": 7,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "ACCOUNT",
                        "SUPPLY_CATEGORY",
                        "ITC_KIND",
                        "COMMERCIAL_USE",
                        "PROVINCIAL_SERVICE",
                        "PROPERTY_REGION",
                        "DIMENSION"
                      ]
                    }
                  }
                },
                "required": [
                  "fields"
                ],
                "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": {
                  "type": "object",
                  "properties": {
                    "rule": {
                      "$ref": "#/components/schemas/ListRulesResponseItem"
                    }
                  },
                  "required": [
                    "rule"
                  ],
                  "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/vendors/{vendorId}/link-bills": {
      "post": {
        "operationId": "linkVendorBills",
        "summary": "Links bills to a vendor.",
        "description": "Links bills to a vendor. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedCount": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "expectedCount"
                ],
                "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": {
                    "linked": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "remaining": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "skipped": {
                      "type": "object",
                      "properties": {
                        "inReview": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "voided": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "inReview",
                        "voided"
                      ],
                      "additionalProperties": false
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "linked",
                    "remaining",
                    "skipped",
                    "entityTimeZone"
                  ],
                  "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/vendors/{vendorId}/links": {
      "post": {
        "operationId": "linkVendor",
        "summary": "Links a vendor to its record in an outside system.",
        "description": "Links a vendor to its record in an outside system. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "QBO",
                      "XERO"
                    ]
                  },
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "externalLabel": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "required": [
                  "provider",
                  "externalId"
                ],
                "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/LinkVendorResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/links/{linkId}/unlink": {
      "post": {
        "operationId": "unlinkVendor",
        "summary": "Removes a vendor's link to its record in an outside system.",
        "description": "Removes a vendor's link to its record in an outside system. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "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/LinkVendorResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/merge-brief": {
      "post": {
        "operationId": "draftVendorMergeBrief",
        "summary": "Drafts the brief a person reads before approving a vendor merge.",
        "description": "Drafts the brief a person reads before approving a vendor merge. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "absorbVendorId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "absorbVendorId"
                ],
                "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": {
                  "$ref": "#/components/schemas/DraftVendorDuplicateBriefResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/merge-preview": {
      "get": {
        "operationId": "previewVendorMerge",
        "summary": "Previews merging one vendor into another before it is proposed.",
        "description": "Previews merging one vendor into another before it is proposed. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "absorbVendorId",
            "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": {
                  "type": "object",
                  "properties": {
                    "survivor": {
                      "$ref": "#/components/schemas/Survivor"
                    },
                    "absorbed": {
                      "$ref": "#/components/schemas/Survivor"
                    },
                    "moves": {
                      "type": "object",
                      "properties": {
                        "bills": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "contacts": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "senderDomains": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "schedules": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "aliases": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "documents": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "agreements": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "withholdingWaivers": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "bills",
                        "contacts",
                        "senderDomains",
                        "schedules",
                        "aliases",
                        "documents",
                        "agreements",
                        "withholdingWaivers"
                      ],
                      "additionalProperties": false
                    },
                    "stays": {
                      "type": "object",
                      "properties": {
                        "payments": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "bankingChanges": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "voidBills": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "billsInReview": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "payments",
                        "bankingChanges",
                        "voidBills",
                        "billsInReview"
                      ],
                      "additionalProperties": false
                    },
                    "duplicateInvoices": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "sample": {
                          "maxItems": 10,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "number": {
                                "type": "string"
                              },
                              "survivorBillId": {
                                "type": "string"
                              },
                              "absorbedBillId": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "number",
                              "survivorBillId",
                              "absorbedBillId"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "total",
                        "sample"
                      ],
                      "additionalProperties": false
                    },
                    "slipYearsProduced": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "taxYear": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "T4A",
                              "T5018"
                            ]
                          }
                        },
                        "required": [
                          "taxYear",
                          "kind"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "blockers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": [
                              "SAME_RECORD",
                              "ABSORBED_ARCHIVED",
                              "SURVIVOR_ARCHIVED",
                              "ABSORBED_REFUSED",
                              "SURVIVOR_REFUSED",
                              "BANKING_OPEN",
                              "BANKING_DIFFERS",
                              "HOLD_WOULD_LIFT",
                              "IN_DRAFT_RUN",
                              "BILLS_IN_REVIEW",
                              "OPEN_CREDIT",
                              "AUTHORITY_SCOPE",
                              "COUNTERPARTY",
                              "COUNTERPARTY_OWN_BILLS",
                              "SLIP_KIND_DIFFERS",
                              "RESIDENCY_DIFFERS",
                              "SLIP_CONSENT_BOTH_LIVE",
                              "ALREADY_PROPOSED",
                              "SURVIVOR_IS_ABSORBED",
                              "PAPER_OVER_CAP",
                              "PRIVACY_REQUEST_OPEN",
                              "PORTAL_SUBMISSION_WAITING",
                              "VENDOR_QUERY_OPEN",
                              "VENDOR_STATEMENT_OPEN"
                            ]
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "enum": [
                              "BUSINESS_NUMBER_DIFFERS",
                              "DUPLICATE_INVOICE_NUMBERS",
                              "SLIP_YEAR_PRODUCED",
                              "SURVIVOR_LACKS",
                              "ABSORBED_HAS_BANKING_IN_FORCE",
                              "PAPER_REQUIREMENTS_NOT_CARRIED"
                            ]
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "evidence": {
                      "type": "object",
                      "properties": {
                        "kinds": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "SAME_BUSINESS_NUMBER",
                              "SAME_BANK_ACCOUNT",
                              "SIMILAR_NAME"
                            ]
                          }
                        },
                        "sentence": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "kinds",
                        "sentence"
                      ],
                      "additionalProperties": false
                    },
                    "seenSha256": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "survivor",
                    "absorbed",
                    "moves",
                    "stays",
                    "duplicateInvoices",
                    "slipYearsProduced",
                    "blockers",
                    "warnings",
                    "evidence",
                    "seenSha256",
                    "entityTimeZone"
                  ],
                  "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/vendors/{vendorId}/notice-recipients": {
      "get": {
        "operationId": "listNoticeRecipients",
        "summary": "Lists who will receive notices for a vendor.",
        "description": "Lists who will receive notices for a vendor. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "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
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "bankingChangeId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "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/Recipients"
                    },
                    "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/vendors/{vendorId}/order-exemption": {
      "post": {
        "operationId": "setVendorOrderExemption",
        "summary": "Exempts a vendor from purchase order requirements.",
        "description": "Exempts a vendor from purchase order requirements. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "exempt": {
                        "type": "boolean",
                        "const": true
                      },
                      "reason": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      }
                    },
                    "required": [
                      "exempt",
                      "reason"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "exempt": {
                        "type": "boolean",
                        "const": false
                      }
                    },
                    "required": [
                      "exempt"
                    ],
                    "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": {
                    "vendorId": {
                      "type": "string"
                    },
                    "exemption": {
                      "$ref": "#/components/schemas/Retired"
                    }
                  },
                  "required": [
                    "vendorId",
                    "exemption"
                  ],
                  "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/vendors/{vendorId}/paper-notice-facts": {
      "get": {
        "operationId": "paperNoticeFacts",
        "summary": "Returns the facts a notice about a vendor's paper is built from.",
        "description": "Returns the facts a notice about a vendor's paper is built from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "DOCUMENT_REQUESTED",
                "NON_RENEWAL_NOTICE"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "agreementId",
            "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": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "DOCUMENT_REQUESTED",
                        "NON_RENEWAL_NOTICE"
                      ]
                    },
                    "facts": {
                      "$ref": "#/components/schemas/PaperFacts"
                    },
                    "preview": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "subject": {
                              "type": "string"
                            },
                            "text": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "subject",
                            "text"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "recipients": {
                      "maxItems": 50,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "email": {
                            "type": "string"
                          },
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "email",
                          "name"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "openDraft": {
                      "$ref": "#/components/schemas/OpenDraft"
                    },
                    "lastSent": {
                      "$ref": "#/components/schemas/LastSent"
                    },
                    "outboundApproved": {
                      "type": "boolean"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind",
                    "facts",
                    "preview",
                    "recipients",
                    "openDraft",
                    "lastSent",
                    "outboundApproved",
                    "entityTimeZone"
                  ],
                  "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/vendors/{vendorId}/paper-notices": {
      "post": {
        "operationId": "draftPaperNotice",
        "summary": "Drafts a notice to a vendor about their paper.",
        "description": "Drafts a notice to a vendor about their paper. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "DOCUMENT_REQUESTED",
                      "NON_RENEWAL_NOTICE"
                    ]
                  },
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "agreementId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "recipientEmail": {
                    "type": "string",
                    "maxLength": 320,
                    "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,}$"
                  },
                  "kinds": {
                    "minItems": 1,
                    "maxItems": 12,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "WSIB_CLEARANCE",
                        "INSURANCE_CERTIFICATE",
                        "MASTER_AGREEMENT",
                        "W8BEN",
                        "DIRECT_DEPOSIT_FORM",
                        "WITHHOLDING_WAIVER",
                        "OTHER"
                      ]
                    }
                  },
                  "sentence": {
                    "$ref": "#/components/schemas/Sentence"
                  }
                },
                "required": [
                  "kind",
                  "entityId",
                  "recipientEmail"
                ],
                "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/DraftBankingNoticeResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/paper-requirements": {
      "post": {
        "operationId": "setVendorPaperRequirements",
        "summary": "Sets the paper a vendor must provide.",
        "description": "Sets the paper a vendor must provide. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kinds": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "WSIB_CLEARANCE",
                        "INSURANCE_CERTIFICATE",
                        "MASTER_AGREEMENT",
                        "W8BEN",
                        "DIRECT_DEPOSIT_FORM",
                        "WITHHOLDING_WAIVER",
                        "OTHER"
                      ]
                    }
                  }
                },
                "required": [
                  "kinds"
                ],
                "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/Standing"
                }
              }
            }
          },
          "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/vendors/{vendorId}/payment-hold": {
      "post": {
        "operationId": "holdVendor",
        "summary": "Puts all payments to a vendor on hold.",
        "description": "Puts all payments to a vendor on hold. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "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
                  },
                  "reasonSource": {
                    "default": "PERSON",
                    "type": "string",
                    "enum": [
                      "PERSON",
                      "AGENT_DRAFT",
                      "AGENT_DRAFT_EDITED"
                    ]
                  },
                  "draftPromptVersion": {
                    "type": "string",
                    "maxLength": 40
                  }
                },
                "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/ListVendorsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/payment-hold/release": {
      "post": {
        "operationId": "releaseVendorHold",
        "summary": "Releases the payment hold on a vendor.",
        "description": "Releases the payment hold on a vendor. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "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/ListVendorsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/payment-terms": {
      "put": {
        "operationId": "setVendorPaymentTerms",
        "summary": "Sets or clears the payment terms of one supplier.",
        "description": "Sets or clears the payment terms of one supplier. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "paymentTermsId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "paymentTermsId"
                ],
                "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": {
                    "vendorId": {
                      "type": "string"
                    },
                    "paymentTermsId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paymentTermsName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "changed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "vendorId",
                    "paymentTermsId",
                    "paymentTermsName",
                    "changed"
                  ],
                  "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/vendors/{vendorId}/payments": {
      "get": {
        "operationId": "listVendorPayments",
        "summary": "Lists the payments made to one vendor, newest first.",
        "description": "Lists the payments made to one vendor, newest first. Needs the `ledger:read` permission. Stable: a change that breaks callers needs 365 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "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"
                          },
                          "method": {
                            "type": "string",
                            "enum": [
                              "RUN",
                              "CARD",
                              "PAD",
                              "ACCOUNT",
                              "CHEQUE",
                              "WIRE",
                              "ETRANSFER",
                              "OTHER"
                            ]
                          },
                          "billId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "runId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "runStatus": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "DRAFT",
                                  "RELEASED",
                                  "CANCELLED"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "paidOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "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"
                              }
                            ]
                          },
                          "billCount": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "runMethod": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "EFT",
                                  "CHEQUE",
                                  "WIRE"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "chequeNumber": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "method",
                          "billId",
                          "billNumber",
                          "runId",
                          "runStatus",
                          "entityId",
                          "entityName",
                          "entityTimeZone",
                          "paidOn",
                          "currency",
                          "amountMinor",
                          "entryNumber",
                          "entryStatus",
                          "billCount",
                          "runMethod",
                          "chequeNumber"
                        ],
                        "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/vendors/{vendorId}/portal-links": {
      "get": {
        "operationId": "listVendorPortalLinks",
        "summary": "Lists the vendor portal links issued for a vendor.",
        "description": "Lists the vendor portal links issued for a vendor. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "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": {
                        "$ref": "#/components/schemas/ListVendorPortalLinksResponseItem"
                      }
                    },
                    "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/vendors/{vendorId}/portal-links/{linkId}/access": {
      "get": {
        "operationId": "listVendorPortalAccess",
        "summary": "Lists when a vendor portal link was opened.",
        "description": "Lists when a vendor portal link was opened. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkId",
            "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"
                          },
                          "event": {
                            "type": "string",
                            "enum": [
                              "OPENED",
                              "DOCUMENT_DOWNLOADED",
                              "FILE_STORED",
                              "PAGE_READ",
                              "INVOICE_SENT",
                              "FACTS_SENT",
                              "PAPER_SENT",
                              "BANKING_SENT",
                              "SUBMISSION_WITHDRAWN",
                              "QUERY_RAISED",
                              "QUERY_MESSAGE_SENT"
                            ]
                          },
                          "at": {
                            "type": "string",
                            "minLength": 20
                          },
                          "userAgent": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "documentName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "submissionId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "event",
                          "at",
                          "userAgent",
                          "documentName",
                          "submissionId"
                        ],
                        "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/vendors/{vendorId}/portal-links/{linkId}/revoke": {
      "post": {
        "operationId": "revokeVendorPortalLink",
        "summary": "Revokes a vendor portal link.",
        "description": "Revokes a vendor portal link. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkId",
            "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/ListVendorPortalLinksResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/privacy-read": {
      "post": {
        "operationId": "readVendorPrivacyMessage",
        "summary": "Reads a privacy message a vendor sent.",
        "description": "Reads a privacy message a vendor sent. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  }
                },
                "required": [
                  "message"
                ],
                "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": {
                    "reading": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "asks": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "SEE_WHAT_YOU_HOLD",
                                  "REMOVE_CONTACT_DETAILS",
                                  "REMOVE_BANK_ACCOUNT",
                                  "REMOVE_EVERYTHING",
                                  "CORRECT_DETAILS",
                                  "OTHER"
                                ]
                              }
                            },
                            "quotes": {
                              "$ref": "#/components/schemas/Quotes"
                            },
                            "language": {
                              "type": "string",
                              "enum": [
                                "en",
                                "fr",
                                "other"
                              ]
                            },
                            "addressedToSystem": {
                              "type": "boolean"
                            },
                            "summary": {
                              "type": "string"
                            },
                            "promptVersion": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "asks",
                            "quotes",
                            "language",
                            "addressedToSystem",
                            "summary",
                            "promptVersion"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "PROVIDER",
                            "DISCLOSURE",
                            "BUDGET",
                            "UNPARSABLE",
                            "REFUSED",
                            "FIGURE_INVENTED",
                            "QUOTE_NOT_IN_MESSAGE",
                            "TOO_LONG"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "reading",
                    "why"
                  ],
                  "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/vendors/{vendorId}/refuse": {
      "post": {
        "operationId": "refuseVendor",
        "summary": "Refuses a vendor that is waiting for acceptance, with a reason.",
        "description": "Refuses a vendor that is waiting for acceptance, with a reason. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "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/ListVendorsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/registration-checks": {
      "post": {
        "operationId": "recordVendorRegistrationCheck",
        "summary": "Records the result of a registration check on a vendor.",
        "description": "Records the result of a registration check on a vendor. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "taxNumber": {
                    "type": "string",
                    "pattern": "^[0-9]{9}RT[0-9]{4}$"
                  },
                  "legalNameChecked": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "confirmedFor": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "REGISTERED",
                      "NOT_REGISTERED",
                      "NO_MATCH"
                    ]
                  },
                  "evidenceDocumentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "evidenceRead": {
                    "type": "string",
                    "enum": [
                      "AGREES",
                      "DIFFERS",
                      "NOT_READ",
                      "NO_EVIDENCE"
                    ]
                  },
                  "evidenceReadPromptVersion": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "note": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": [
                  "taxNumber",
                  "legalNameChecked",
                  "confirmedFor",
                  "outcome",
                  "evidenceRead"
                ],
                "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": {
                    "check": {
                      "$ref": "#/components/schemas/Check"
                    },
                    "registration": {
                      "type": "object",
                      "properties": {
                        "standing": {
                          "type": "string",
                          "enum": [
                            "NO_NUMBER",
                            "UNCHECKED",
                            "CONFIRMED",
                            "NOT_REGISTERED",
                            "NO_MATCH"
                          ]
                        },
                        "inForce": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Check"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "standing",
                        "inForce"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "check",
                    "registration"
                  ],
                  "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"
          }
        }
      },
      "get": {
        "operationId": "listVendorRegistrationChecks",
        "summary": "Lists the registration checks made on a vendor.",
        "description": "Lists the registration checks made on a vendor. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "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": {
                        "$ref": "#/components/schemas/Check"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "entityTimeZone"
                  ],
                  "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/vendors/{vendorId}/registration-evidence/read": {
      "post": {
        "operationId": "readRegistrationEvidence",
        "summary": "Reads the evidence a vendor's registration arrived with.",
        "description": "Reads the evidence a vendor's registration arrived with. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-eternify-read": true,
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "documentId"
                ],
                "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": {
                    "read": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "pageKind": {
                              "type": "string",
                              "enum": [
                                "GST_HST_REGISTRY_RESULT",
                                "OTHER"
                              ]
                            },
                            "statusPrinted": {
                              "type": "string",
                              "enum": [
                                "REGISTERED",
                                "NOT_REGISTERED",
                                "NO_MATCH",
                                "NOT_STATED"
                              ]
                            },
                            "namePrinted": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 200
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "datePrinted": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "legible": {
                              "type": "boolean"
                            },
                            "note": {
                              "type": "string",
                              "maxLength": 200
                            },
                            "numberOnPage": {
                              "type": "string",
                              "enum": [
                                "AGREES",
                                "DIFFERS",
                                "NOT_FOUND"
                              ]
                            },
                            "nameOnPage": {
                              "type": "string",
                              "enum": [
                                "AGREES",
                                "DIFFERS",
                                "NOT_FOUND"
                              ]
                            },
                            "promptVersion": {
                              "type": "string"
                            },
                            "documentChars": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            },
                            "readChars": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "pageKind",
                            "statusPrinted",
                            "namePrinted",
                            "datePrinted",
                            "legible",
                            "note",
                            "numberOnPage",
                            "nameOnPage",
                            "promptVersion",
                            "documentChars",
                            "readChars"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "type": "string",
                      "enum": [
                        "UNREADABLE",
                        "DISCLOSURE",
                        "BUDGET",
                        "PROVIDER",
                        "UNPARSABLE",
                        "REFUSED"
                      ]
                    }
                  },
                  "required": [
                    "read"
                  ],
                  "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/vendors/{vendorId}/restore": {
      "post": {
        "operationId": "restoreVendor",
        "summary": "Restores an archived vendor so bills can be raised against it again.",
        "description": "Restores an archived vendor so bills can be raised against it again. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "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/ListVendorsResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/sender-domains": {
      "get": {
        "operationId": "listVendorSenderDomains",
        "summary": "Lists the email domains a vendor is known to send from.",
        "description": "Lists the email domains a vendor is known to send from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "KNOWN",
                "RETIRED"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "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/ListVendorSenderDomainsResponseItem"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "entityTimeZone"
                  ],
                  "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/vendors/{vendorId}/sender-domains/{senderDomainId}/restore": {
      "post": {
        "operationId": "restoreVendorSenderDomain",
        "summary": "Restores a retired email domain to a vendor.",
        "description": "Restores a retired email domain to a vendor. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "senderDomainId",
            "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": 4,
                    "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/RetireVendorSenderDomainResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/sender-domains/{senderDomainId}/retire": {
      "post": {
        "operationId": "retireVendorSenderDomain",
        "summary": "Retires an email domain a vendor no longer sends from.",
        "description": "Retires an email domain a vendor no longer sends from. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "senderDomainId",
            "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": 4,
                    "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/RetireVendorSenderDomainResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/slip-identity-ask": {
      "post": {
        "operationId": "draftSlipIdentityAsk",
        "summary": "Drafts the request asking a vendor for their slip identity.",
        "description": "Drafts the request asking a vendor for their slip identity. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "T4A",
                      "T5018"
                    ]
                  },
                  "periodEnd": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "recipientEmail": {
                    "type": "string",
                    "maxLength": 320,
                    "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,}$"
                  }
                },
                "required": [
                  "entityId",
                  "kind",
                  "recipientEmail"
                ],
                "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/DraftBankingNoticeResponse"
                }
              }
            }
          },
          "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/vendors/{vendorId}/slip-identity-ask-facts": {
      "get": {
        "operationId": "getSlipIdentityAskFacts",
        "summary": "Returns the facts a request for a vendor's slip identity is built from.",
        "description": "Returns the facts a request for a vendor's slip identity is built from. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "T4A",
                "T5018"
              ]
            }
          },
          {
            "name": "periodEnd",
            "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": {
                    "vendor": {
                      "$ref": "#/components/schemas/VendorOption1"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "RECIPIENT_TYPE",
                          "SURNAME",
                          "LEGAL_NAME",
                          "BUSINESS_NUMBER",
                          "PROVINCE",
                          "COUNTRY",
                          "ADDRESS"
                        ]
                      }
                    },
                    "addressIncomplete": {
                      "type": "boolean"
                    },
                    "defaultRecipient": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "email": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "email",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "contact": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "telephone": {
                              "type": "string"
                            },
                            "replyTo": {
                              "type": "string"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "SETTINGS",
                                "ADDRESS_WATCHER"
                              ]
                            }
                          },
                          "required": [
                            "name",
                            "telephone",
                            "replyTo",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "facts": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "SLIP_IDENTITY_ASK"
                            },
                            "common": {
                              "$ref": "#/components/schemas/Common"
                            },
                            "slipKind": {
                              "type": "string",
                              "enum": [
                                "T4A",
                                "T5018"
                              ]
                            },
                            "taxYear": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "items": {
                              "minItems": 1,
                              "maxItems": 7,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": [
                                  "RECIPIENT_TYPE",
                                  "SURNAME",
                                  "LEGAL_NAME",
                                  "BUSINESS_NUMBER",
                                  "PROVINCE",
                                  "COUNTRY",
                                  "ADDRESS"
                                ]
                              }
                            }
                          },
                          "required": [
                            "kind",
                            "common",
                            "slipKind",
                            "taxYear",
                            "entityId",
                            "items"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "alreadyAsked": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "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}$"
                            },
                            "recipientEmail": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "by",
                            "on",
                            "recipientEmail"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "openDraft": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "noticeId": {
                              "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": [
                            "noticeId",
                            "by",
                            "on"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "outboundApproved": {
                      "type": "boolean"
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "vendor",
                    "items",
                    "addressIncomplete",
                    "defaultRecipient",
                    "contact",
                    "facts",
                    "alreadyAsked",
                    "openDraft",
                    "outboundApproved",
                    "entityTimeZone"
                  ],
                  "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/vendors/{vendorId}/slip-position": {
      "get": {
        "operationId": "getVendorSlipPosition",
        "summary": "Returns the slip position of a vendor.",
        "description": "Returns the slip position of a vendor. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "taxYear",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 2000,
              "maximum": 2100
            }
          }
        ],
        "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": {
                    "entityTimeZone": {
                      "type": "string"
                    },
                    "positions": {
                      "maxItems": 40,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entity": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "T4A",
                              "T5018"
                            ]
                          },
                          "taxYear": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "measuredMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "projectedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "thresholdMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "gapCodes": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "RECIPIENT_TYPE",
                                "SURNAME",
                                "LEGAL_NAME",
                                "BUSINESS_NUMBER",
                                "PROVINCE",
                                "COUNTRY"
                              ]
                            }
                          },
                          "readiness": {
                            "type": "string",
                            "enum": [
                              "NEEDS_DETAILS",
                              "GAPS_UNDER_THRESHOLD",
                              "READY"
                            ]
                          },
                          "copy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "NOT_PRODUCED",
                                      "PRODUCED",
                                      "DRAFTED",
                                      "BOUNCED",
                                      "EMAILED",
                                      "POSTED"
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "state"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "entity",
                          "kind",
                          "taxYear",
                          "measuredMinor",
                          "projectedMinor",
                          "thresholdMinor",
                          "gapCodes",
                          "readiness",
                          "copy"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "entityTimeZone",
                    "positions",
                    "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/vendors/{vendorId}/unlinked-bills": {
      "get": {
        "operationId": "listVendorUnlinkedBills",
        "summary": "Lists the bills of a vendor that are not linked to it.",
        "description": "Lists the bills of a vendor that are not linked to it. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "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": {
                          "billId": {
                            "type": "string"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "supplierName": {
                            "type": "string"
                          },
                          "billDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "DRAFT",
                              "IN_REVIEW",
                              "DECLINED",
                              "APPROVED",
                              "HELD",
                              "OPEN",
                              "DUE",
                              "OVERDUE",
                              "IN_RUN",
                              "PARTIALLY_PAID",
                              "PAID",
                              "VOID"
                            ]
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "linkable": {
                            "type": "boolean"
                          },
                          "why": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "billId",
                          "number",
                          "supplierName",
                          "billDate",
                          "status",
                          "totalMinor",
                          "currency",
                          "entityName",
                          "linkable",
                          "why"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "linkableTotal": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "inReview": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "voided": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "needsApprover": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "entityTimeZone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "linkableTotal",
                    "inReview",
                    "voided",
                    "needsApprover",
                    "entityTimeZone"
                  ],
                  "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/vendors/{vendorId}/withholding-bills": {
      "get": {
        "operationId": "listVendorWithholdingBills",
        "summary": "Lists the bills of a vendor that carry withholding.",
        "description": "Lists the bills of a vendor that carry withholding. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "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"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "billDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "totalMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "undecidedLines": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "id",
                          "number",
                          "billDate",
                          "totalMinor",
                          "currency",
                          "undecidedLines"
                        ],
                        "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/vendors/{vendorId}/withholding-waivers": {
      "get": {
        "operationId": "listVendorWithholdingWaivers",
        "summary": "Lists the withholding waivers granted to a vendor.",
        "description": "Lists the withholding waivers granted to a vendor. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "vendorId",
            "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
            }
          },
          {
            "name": "entityId",
            "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ListVendorWithholdingWaiversResponseItem"
                      }
                    },
                    "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": "recordVendorWithholdingWaiver",
        "summary": "Records a withholding waiver granted to a vendor.",
        "description": "Records a withholding waiver granted to a vendor. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "vendorDocumentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "craReference": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 40
                  },
                  "rateBp": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1499
                  },
                  "validFrom": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "validTo": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "entityId",
                  "vendorDocumentId",
                  "craReference",
                  "rateBp",
                  "validFrom",
                  "validTo"
                ],
                "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/ListVendorWithholdingWaiversResponseItem"
                }
              }
            }
          },
          "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/vendors/{vendorId}/withholding-waivers/{waiverId}/end": {
      "post": {
        "operationId": "endVendorWithholdingWaiver",
        "summary": "Ends a withholding waiver granted to a vendor.",
        "description": "Ends a withholding waiver granted to a vendor. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "vendorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "waiverId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "endedOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 500
                  }
                },
                "required": [
                  "endedOn",
                  "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/ListVendorWithholdingWaiversResponseItem"
                }
              }
            }
          },
          "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/warehouse/destinations": {
      "get": {
        "operationId": "listWarehouseDestinations",
        "summary": "Lists the data warehouses these books are sent to, with how current each copy is.",
        "description": "Lists the data warehouses these books are sent to, with how current each copy is. Needs the `warehouse:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "warehouse: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": {
                        "$ref": "#/components/schemas/ListWarehouseDestinationsResponseItem"
                      }
                    },
                    "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/warehouse/destinations/{destinationId}": {
      "get": {
        "operationId": "getWarehouseDestination",
        "summary": "Returns one data warehouse destination with its state, its failure if any and how current it is.",
        "description": "Returns one data warehouse destination with its state, its failure if any and how current it is. Needs the `warehouse:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "warehouse:read",
        "parameters": [
          {
            "name": "destinationId",
            "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/ListWarehouseDestinationsResponseItem"
                }
              }
            }
          },
          "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/warehouse/destinations/{destinationId}/backfill": {
      "post": {
        "operationId": "backfillWarehouse",
        "summary": "Sends every table, or the tables named, to a data warehouse again.",
        "description": "Sends every table, or the tables named, to a data warehouse again. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "destinationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tables": {
                    "maxItems": 300,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    }
                  }
                },
                "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/ListWarehouseDestinationsResponseItem"
                    },
                    {
                      "$ref": "#/components/schemas/UndoAgentBatchResponse"
                    }
                  ]
                }
              }
            }
          },
          "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/warehouse/destinations/{destinationId}/pause": {
      "post": {
        "operationId": "pauseWarehouseDestination",
        "summary": "Pauses sending the books to a data warehouse; nothing is lost and it resumes from where it stopped.",
        "description": "Pauses sending the books to a data warehouse; nothing is lost and it resumes from where it stopped. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "destinationId",
            "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": 300
                  }
                },
                "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/ListWarehouseDestinationsResponseItem"
                }
              }
            }
          },
          "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/warehouse/destinations/{destinationId}/setup": {
      "get": {
        "operationId": "getWarehouseSetup",
        "summary": "Returns the steps the owner of a data warehouse follows to let these books write to it.",
        "description": "Returns the steps the owner of a data warehouse follows to let these books write to it. Needs the `warehouse:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "warehouse:read",
        "parameters": [
          {
            "name": "destinationId",
            "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": {
                    "destination": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9-]{1,31}$"
                    },
                    "steps": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          },
                          "code": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "title",
                          "text",
                          "code"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "destination",
                    "kind",
                    "steps"
                  ],
                  "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/warehouse/destinations/{destinationId}/tables": {
      "get": {
        "operationId": "listWarehouseTables",
        "summary": "Lists the tables sent to a data warehouse, with rows, position reached and the last nightly check.",
        "description": "Lists the tables sent to a data warehouse, with rows, position reached and the last nightly check. Needs the `warehouse:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "warehouse:read",
        "parameters": [
          {
            "name": "destinationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "mode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "target",
                "child",
                "append",
                "nightly"
              ]
            }
          },
          {
            "name": "drifted",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "table": {
                            "type": "string"
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "target",
                              "child",
                              "append",
                              "nightly"
                            ]
                          },
                          "rows": {
                            "type": "string",
                            "pattern": "^\\d+$"
                          },
                          "lastPosition": {
                            "type": "string",
                            "pattern": "^(0|[1-9]\\d{0,18})$"
                          },
                          "schemaVersion": {
                            "type": "string"
                          },
                          "retiredColumns": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "backfill": {
                            "type": "string",
                            "enum": [
                              "none",
                              "queued",
                              "running",
                              "done",
                              "failed",
                              "cancelled"
                            ]
                          },
                          "verify": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "at": {
                                    "type": "string",
                                    "minLength": 20
                                  },
                                  "drift": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "at",
                                  "drift"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "state": {
                                    "type": "string",
                                    "enum": [
                                      "not-permitted",
                                      "never"
                                    ]
                                  }
                                },
                                "required": [
                                  "state"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "table",
                          "mode",
                          "rows",
                          "lastPosition",
                          "schemaVersion",
                          "retiredColumns",
                          "backfill",
                          "verify"
                        ],
                        "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/warehouse/destinations/{destinationId}/test": {
      "post": {
        "operationId": "testWarehouseDestination",
        "summary": "Tests whether these books can write to a data warehouse and reports where it is stored.",
        "description": "Tests whether these books can write to a data warehouse and reports where it is stored. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "destinationId",
            "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": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "location": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "inCanada": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "checks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "enum": [
                              "identity",
                              "target",
                              "verified",
                              "ddl",
                              "write",
                              "read"
                            ]
                          },
                          "ok": {
                            "type": "boolean"
                          },
                          "code": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "access_denied",
                                  "target_unverified",
                                  "target_not_found",
                                  "schema_conflict",
                                  "quota",
                                  "transient",
                                  "internal"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "remedy": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "name",
                          "ok",
                          "code",
                          "remedy"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "ok",
                    "location",
                    "inCanada",
                    "checks"
                  ],
                  "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/warehouse/kinds": {
      "get": {
        "operationId": "listWarehouseKinds",
        "summary": "Lists the kinds of data warehouse these books can be sent to, with the fields each asks for.",
        "description": "Lists the kinds of data warehouse these books can be sent to, with the fields each asks for. Needs the `warehouse:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "warehouse: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": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9-]{1,31}$"
                          },
                          "label": {
                            "type": "string"
                          },
                          "fields": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "help": {
                                  "type": "string"
                                },
                                "pattern": {
                                  "type": "string"
                                },
                                "maxLength": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "required": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "name",
                                "label",
                                "help",
                                "pattern",
                                "maxLength",
                                "required"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "options": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string"
                                },
                                "choices": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "value": {
                                        "type": "string"
                                      },
                                      "label": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "value",
                                      "label"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "default": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "name",
                                "label",
                                "choices",
                                "default"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "credential": {
                            "type": "string",
                            "enum": [
                              "none",
                              "sealed"
                            ]
                          },
                          "canRotate": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "kind",
                          "label",
                          "fields",
                          "options",
                          "credential",
                          "canRotate"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "destination": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "message": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor",
                    "total",
                    "destination",
                    "message"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Problem401"
          },
          "403": {
            "$ref": "#/components/responses/Problem403"
          },
          "429": {
            "$ref": "#/components/responses/Problem429"
          },
          "500": {
            "$ref": "#/components/responses/Problem500"
          }
        }
      }
    },
    "/v1/workflow-actions": {
      "get": {
        "operationId": "listWorkflowActions",
        "summary": "Lists the operations an automation workflow can run as its actions, with the input each one takes.",
        "description": "Lists the operations an automation workflow can run as its actions, with the input each one takes. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "recordKind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "VENDOR",
                "BILL",
                "PURCHASE_ORDER",
                "INVOICE",
                "CUSTOMER",
                "RECEIPT",
                "JOURNAL_ENTRY",
                "PAYMENT_RUN"
              ]
            }
          }
        ],
        "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": {
                          "operation": {
                            "type": "string"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "effectClass": {
                            "type": "string",
                            "enum": [
                              "read",
                              "write",
                              "delete",
                              "money-out",
                              "banking",
                              "cra-filing"
                            ]
                          },
                          "proposes": {
                            "type": "boolean"
                          },
                          "params": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "input": {
                            "anyOf": [
                              {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {},
                                "description": "A JSON Schema (draft 2020-12) document: the input of the operation this action runs, as that operation's own entry in this contract gives it.",
                                "x-open-by-reference": true
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "recordKinds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "operation",
                          "summary",
                          "effectClass",
                          "proposes",
                          "params",
                          "input",
                          "recordKinds"
                        ],
                        "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/workflow-notices": {
      "post": {
        "operationId": "sendWorkflowNotice",
        "summary": "Sends a notice by mail to people who hold a seat on these books.",
        "description": "Sends a notice by mail to people who hold a seat on these books. Needs the `ledger:propose` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:propose",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to": {
                    "minItems": 1,
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "subject": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  },
                  "recordRef": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "minLength": 1
                          },
                          "id": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "type",
                          "id"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "to",
                  "subject",
                  "body",
                  "recordRef"
                ],
                "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": {
                  "type": "object",
                  "properties": {
                    "recipients": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "sentAt": {
                      "type": "string",
                      "minLength": 20
                    }
                  },
                  "required": [
                    "recipients",
                    "sentAt"
                  ],
                  "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"
          }
        }
      }
    },
    "/v1/workflow-runs": {
      "get": {
        "operationId": "listWorkflowRuns",
        "summary": "Lists the times workflows fired, newest first, with what each did.",
        "description": "Lists the times workflows fired, newest first, with what each did. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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
            }
          },
          {
            "name": "workflowId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "APPROVAL",
                "AUTOMATION"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ROUTED",
                "QUEUED",
                "RUNNING",
                "SUCCEEDED",
                "PROPOSED",
                "FAILED",
                "SKIPPED",
                "CAPPED",
                "LOOP_STOPPED",
                "CANCELLED",
                "REFUSED"
              ]
            }
          },
          {
            "name": "targetType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 40
            }
          },
          {
            "name": "targetId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 20
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 20
            }
          }
        ],
        "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/ListWorkflowRunsResponseItem"
                      }
                    },
                    "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/workflow-runs/{runId}": {
      "get": {
        "operationId": "getWorkflowRun",
        "summary": "Returns one workflow run with each of its steps.",
        "description": "Returns one workflow run with each of its steps. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "runId",
            "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/ListWorkflowRunsResponseItem"
                }
              }
            }
          },
          "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/workflow-triggers": {
      "get": {
        "operationId": "listWorkflowTriggers",
        "summary": "Lists the changes an automation workflow can start on.",
        "description": "Lists the changes an automation workflow can start on. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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": {
                          "type": {
                            "type": "string"
                          },
                          "recordKind": {
                            "type": "string",
                            "enum": [
                              "VENDOR",
                              "BILL",
                              "PURCHASE_ORDER",
                              "INVOICE",
                              "CUSTOMER",
                              "RECEIPT",
                              "JOURNAL_ENTRY",
                              "PAYMENT_RUN"
                            ]
                          },
                          "label": {
                            "type": "string"
                          },
                          "read": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "recordKind",
                          "label",
                          "read"
                        ],
                        "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/workflows": {
      "get": {
        "operationId": "listWorkflows",
        "summary": "Lists the approval and automation workflows on these books, with each one's status and owner.",
        "description": "Lists the approval and automation workflows on these books, with each one's status and owner. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "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
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "APPROVAL",
                "AUTOMATION"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "ACTIVE",
                "PAUSED",
                "EXPIRED",
                "RETIRED"
              ]
            }
          },
          {
            "name": "subject",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BILL",
                "INVOICE",
                "PURCHASE_ORDER"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          }
        ],
        "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/ListWorkflowsResponseItem"
                      }
                    },
                    "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": "createWorkflowDraft",
        "summary": "Drafts a new approval or automation workflow; nothing runs until an administrator turns it on.",
        "description": "Drafts a new approval or automation workflow; nothing runs until an administrator turns it on. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50
                  },
                  "description": {
                    "default": "",
                    "type": "string",
                    "maxLength": 300
                  },
                  "definition": {
                    "$ref": "#/components/schemas/Definition2"
                  },
                  "expiresOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "name",
                  "definition",
                  "expiresOn"
                ],
                "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/ListWorkflowsResponseItem"
                }
              }
            }
          },
          "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/workflows/{workflowId}": {
      "get": {
        "operationId": "getWorkflow",
        "summary": "Returns one workflow with its active version, its draft and what the reader may do with it.",
        "description": "Returns one workflow with its active version, its draft and what the reader may do with it. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "workflowId",
            "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/ListWorkflowsResponseItem"
                }
              }
            }
          },
          "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/workflows/{workflowId}/draft": {
      "patch": {
        "operationId": "updateWorkflowDraft",
        "summary": "Changes the draft of a workflow; the active version keeps running until the draft is turned on.",
        "description": "Changes the draft of a workflow; the active version keeps running until the draft is turned on. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "workflowId",
            "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": 50
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "definition": {
                    "$ref": "#/components/schemas/Definition2"
                  },
                  "expiresOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "basedOnVersion": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "basedOnVersion"
                ],
                "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/ListWorkflowsResponseItem"
                }
              }
            }
          },
          "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/workflows/{workflowId}/draft/discard": {
      "post": {
        "operationId": "discardWorkflowDraft",
        "summary": "Discards the draft of a workflow; the active version is unchanged.",
        "description": "Discards the draft of a workflow; the active version is unchanged. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "workflowId",
            "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/ListWorkflowsResponseItem"
                }
              }
            }
          },
          "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/workflows/{workflowId}/draft/preview": {
      "post": {
        "operationId": "previewWorkflow",
        "summary": "Previews what the draft of a workflow would have done to recent records, and keeps the preview as evidence.",
        "description": "Previews what the draft of a workflow would have done to recent records, and keeps the preview as evidence. Needs the `ledger:admin` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:admin",
        "parameters": [
          {
            "name": "workflowId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "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/PreviewOption1"
                }
              }
            }
          },
          "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/workflows/{workflowId}/versions": {
      "get": {
        "operationId": "listWorkflowVersions",
        "summary": "Lists the versions of one workflow, newest first, each in sentences.",
        "description": "Lists the versions of one workflow, newest first, each in sentences. Needs the `ledger:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "settings"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:read",
        "parameters": [
          {
            "name": "workflowId",
            "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": {
                        "$ref": "#/components/schemas/ActiveOption1"
                      }
                    },
                    "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/year-end-files": {
      "get": {
        "operationId": "listYearEndFiles",
        "summary": "Lists the year end files produced, with the server's total.",
        "description": "Lists the year end files produced, with the server's total. Needs the `audit:read` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "audit:read",
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "BUILDING",
                "READY",
                "SIGNED",
                "FAILED"
              ]
            }
          },
          {
            "name": "yearEnd",
            "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": 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": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "companyName": {
                            "type": "string"
                          },
                          "entityTimeZone": {
                            "type": "string"
                          },
                          "yearStart": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "yearEnd": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "currency": {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "BUILDING",
                              "READY",
                              "SIGNED",
                              "FAILED"
                            ]
                          },
                          "subsequentDays": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "cutOffDays": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "progress": {
                            "type": "object",
                            "properties": {
                              "done": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "failed": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "total": {
                                "type": "number",
                                "const": 12
                              }
                            },
                            "required": [
                              "done",
                              "failed",
                              "total"
                            ],
                            "additionalProperties": false
                          },
                          "startedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "startedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "builtAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "memberCount": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "byteSize": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "manifestSha256": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[0-9a-f]{64}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "failureReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "booksLocked": {
                            "type": "object",
                            "properties": {
                              "atStart": {
                                "type": "boolean"
                              },
                              "atFinish": {
                                "type": [
                                  "boolean",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "atStart",
                              "atFinish"
                            ],
                            "additionalProperties": false
                          },
                          "signed": {
                            "$ref": "#/components/schemas/Decision2"
                          },
                          "newerFileId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "jobId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "headline": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "owedMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "unexplainedMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "subsequentMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "atRiskAndUntestedMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "ownWorkCount": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "owedMinor",
                                  "unexplainedMinor",
                                  "subsequentMinor",
                                  "atRiskAndUntestedMinor",
                                  "ownWorkCount"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "companyName",
                          "entityTimeZone",
                          "yearStart",
                          "yearEnd",
                          "currency",
                          "state",
                          "subsequentDays",
                          "cutOffDays",
                          "progress",
                          "startedBy",
                          "startedAt",
                          "builtAt",
                          "memberCount",
                          "byteSize",
                          "manifestSha256",
                          "failureReason",
                          "booksLocked",
                          "signed",
                          "newerFileId",
                          "jobId",
                          "headline"
                        ],
                        "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/year-end-files/{yearEndFileId}/commentary": {
      "post": {
        "operationId": "draftYearEndCommentary",
        "summary": "Drafts the commentary that goes with a year end file.",
        "description": "Drafts the commentary that goes with a year end file. Needs the `ledger:approve` permission. Beta: it can change with 30 days' notice.",
        "tags": [
          "close"
        ],
        "x-stability-level": "beta",
        "x-scope": "ledger:approve",
        "parameters": [
          {
            "name": "yearEndFileId",
            "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": {
                    "drafted": {
                      "type": "boolean"
                    },
                    "why": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "DISCLOSURE",
                            "BUDGET",
                            "PROVIDER",
                            "UNPARSABLE",
                            "REFUSED",
                            "FIGURE_NOT_HELD",
                            "NO_CITATION",
                            "UNKNOWN_SECTION",
                            "UNKNOWN_FIGURE",
                            "TOO_MANY"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "proposed": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "ruleKept": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "leftToYou": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "AGEING",
                          "UNEXPLAINED",
                          "SUBSEQUENT",
                          "ITC",
                          "RETURNS",
                          "SLIPS",
                          "PAYMENTS",
                          "BANKING",
                          "SUPPLIERS",
                          "POLICIES",
                          "OWN_WORK",
                          "CUT_OFF"
                        ]
                      }
                    },
                    "attempts": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "drafted",
                    "why",
                    "proposed",
                    "ruleKept",
                    "leftToYou",
                    "attempts"
                  ],
                  "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"
          }
        }
      }
    }
  },
  "webhooks": {
    "bill.approved.v1": {
      "post": {
        "summary": "Bill event: approved.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getBill (GET /v1/bills/{billId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Bill",
        "x-read-operation": "getBill",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "bill.approved.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data3"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "bill.declined.v1": {
      "post": {
        "summary": "Bill event: declined.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getBill (GET /v1/bills/{billId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Bill",
        "x-read-operation": "getBill",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "bill.declined.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data3"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "bill.drafted.v1": {
      "post": {
        "summary": "Bill event: drafted.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getBill (GET /v1/bills/{billId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Bill",
        "x-read-operation": "getBill",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "bill.drafted.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data3"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "bill.held.v1": {
      "post": {
        "summary": "Bill event: held.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getBill (GET /v1/bills/{billId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Bill",
        "x-read-operation": "getBill",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "bill.held.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data3"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "bill.holdReleased.v1": {
      "post": {
        "summary": "Bill event: hold released.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getBill (GET /v1/bills/{billId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Bill",
        "x-read-operation": "getBill",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "bill.holdReleased.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data3"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "bill.paymentApplied.v1": {
      "post": {
        "summary": "Bill event: payment applied.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getBill (GET /v1/bills/{billId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Bill",
        "x-read-operation": "getBill",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "bill.paymentApplied.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data3"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "bill.paymentReturned.v1": {
      "post": {
        "summary": "Bill event: payment returned.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getBill (GET /v1/bills/{billId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Bill",
        "x-read-operation": "getBill",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "bill.paymentReturned.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data3"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "bill.submitted.v1": {
      "post": {
        "summary": "Bill event: submitted.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getBill (GET /v1/bills/{billId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Bill",
        "x-read-operation": "getBill",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "bill.submitted.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data3"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "bill.voided.v1": {
      "post": {
        "summary": "Bill event: voided.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getBill (GET /v1/bills/{billId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Bill",
        "x-read-operation": "getBill",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "bill.voided.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data3"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "job.cancelled.v1": {
      "post": {
        "summary": "Job event: cancelled.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getJob (GET /v1/jobs/{jobId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-subject": "Job",
        "x-read-operation": "getJob",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "job.cancelled.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data7"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "job.failed.v1": {
      "post": {
        "summary": "Job event: failed.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getJob (GET /v1/jobs/{jobId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-subject": "Job",
        "x-read-operation": "getJob",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "job.failed.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data7"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "job.succeeded.v1": {
      "post": {
        "summary": "Job event: succeeded.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getJob (GET /v1/jobs/{jobId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "platform"
        ],
        "x-stability-level": "beta",
        "x-subject": "Job",
        "x-read-operation": "getJob",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "job.succeeded.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data7"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "paymentRun.cancelled.v1": {
      "post": {
        "summary": "Payment run event: cancelled.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getPaymentRun (GET /v1/payment-runs/{runId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "stable",
        "x-subject": "PaymentRun",
        "x-read-operation": "getPaymentRun",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "paymentRun.cancelled.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data4"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "paymentRun.paymentReversed.v1": {
      "post": {
        "summary": "Payment run event: payment reversed.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getPaymentRun (GET /v1/payment-runs/{runId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "stable",
        "x-subject": "PaymentRun",
        "x-read-operation": "getPaymentRun",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "paymentRun.paymentReversed.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data4"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "paymentRun.prepared.v1": {
      "post": {
        "summary": "Payment run event: prepared.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getPaymentRun (GET /v1/payment-runs/{runId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "stable",
        "x-subject": "PaymentRun",
        "x-read-operation": "getPaymentRun",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "paymentRun.prepared.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data4"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "paymentRun.released.v1": {
      "post": {
        "summary": "Payment run event: released.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getPaymentRun (GET /v1/payment-runs/{runId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "stable",
        "x-subject": "PaymentRun",
        "x-read-operation": "getPaymentRun",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "paymentRun.released.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data4"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "paymentRun.reversed.v1": {
      "post": {
        "summary": "Payment run event: reversed.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getPaymentRun (GET /v1/payment-runs/{runId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "banking-and-payments"
        ],
        "x-stability-level": "stable",
        "x-subject": "PaymentRun",
        "x-read-operation": "getPaymentRun",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "paymentRun.reversed.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data4"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "purchaseOrder.approved.v1": {
      "post": {
        "summary": "Purchase order event: approved.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getPurchaseOrder (GET /v1/purchase-orders/{purchaseOrderId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "PurchaseOrder",
        "x-read-operation": "getPurchaseOrder",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "purchaseOrder.approved.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data5"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "purchaseOrder.cancelled.v1": {
      "post": {
        "summary": "Purchase order event: cancelled.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getPurchaseOrder (GET /v1/purchase-orders/{purchaseOrderId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "PurchaseOrder",
        "x-read-operation": "getPurchaseOrder",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "purchaseOrder.cancelled.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data5"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "purchaseOrder.sent.v1": {
      "post": {
        "summary": "Purchase order event: sent.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getPurchaseOrder (GET /v1/purchase-orders/{purchaseOrderId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "PurchaseOrder",
        "x-read-operation": "getPurchaseOrder",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "purchaseOrder.sent.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data5"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "vendor.accepted.v1": {
      "post": {
        "summary": "Vendor event: accepted.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getVendor (GET /v1/vendors/{vendorId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Vendor",
        "x-read-operation": "getVendor",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "vendor.accepted.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data2"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "vendor.archived.v1": {
      "post": {
        "summary": "Vendor event: archived.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getVendor (GET /v1/vendors/{vendorId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Vendor",
        "x-read-operation": "getVendor",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "vendor.archived.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data2"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "vendor.bankingChangeProposed.v1": {
      "post": {
        "summary": "Vendor event: banking change proposed.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getVendor (GET /v1/vendors/{vendorId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Vendor",
        "x-read-operation": "getVendor",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "vendor.bankingChangeProposed.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data2"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "vendor.bankingVerified.v1": {
      "post": {
        "summary": "Vendor event: banking verified.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getVendor (GET /v1/vendors/{vendorId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Vendor",
        "x-read-operation": "getVendor",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "vendor.bankingVerified.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data2"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "vendor.created.v1": {
      "post": {
        "summary": "Vendor event: created.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getVendor (GET /v1/vendors/{vendorId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Vendor",
        "x-read-operation": "getVendor",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "vendor.created.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data2"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "vendor.paymentHeld.v1": {
      "post": {
        "summary": "Vendor event: payment held.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getVendor (GET /v1/vendors/{vendorId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Vendor",
        "x-read-operation": "getVendor",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "vendor.paymentHeld.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data2"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "vendor.paymentHoldReleased.v1": {
      "post": {
        "summary": "Vendor event: payment hold released.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getVendor (GET /v1/vendors/{vendorId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Vendor",
        "x-read-operation": "getVendor",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "vendor.paymentHoldReleased.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data2"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "vendor.restored.v1": {
      "post": {
        "summary": "Vendor event: restored.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getVendor (GET /v1/vendors/{vendorId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Vendor",
        "x-read-operation": "getVendor",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "vendor.restored.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data2"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "vendor.updated.v1": {
      "post": {
        "summary": "Vendor event: updated.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getVendor (GET /v1/vendors/{vendorId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "Vendor",
        "x-read-operation": "getVendor",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "vendor.updated.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data2"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "vendorCredit.applied.v1": {
      "post": {
        "summary": "Vendor credit event: applied.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getVendorCredit (GET /v1/vendor-credits/{vendorCreditId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "VendorCredit",
        "x-read-operation": "getVendorCredit",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "vendorCredit.applied.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data6"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    },
    "vendorCredit.approved.v1": {
      "post": {
        "summary": "Vendor credit event: approved.",
        "description": "Delivered to your webhook endpoint when this happens. The body is a pointer: read the record with getVendorCredit (GET /v1/vendor-credits/{vendorCreditId}). Return a 2xx status to acknowledge it; a 410 pauses the endpoint.",
        "tags": [
          "purchases"
        ],
        "x-stability-level": "stable",
        "x-subject": "VendorCredit",
        "x-read-operation": "getVendorCredit",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The delivery's id; the same on every retry.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix seconds when the delivery was signed.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "One or more `v1,` signatures over id, timestamp and the raw body (two during a secret rotation).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^evt_.*"
                  },
                  "type": {
                    "type": "string",
                    "const": "vendorCredit.approved.v1"
                  },
                  "timestamp": {
                    "type": "string",
                    "minLength": 20
                  },
                  "apiVersion": {
                    "type": "string",
                    "const": "v1"
                  },
                  "ledgerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Data6"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "timestamp",
                  "apiVersion",
                  "ledgerId",
                  "position",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "410": {
            "description": "The receiver is gone. The endpoint is paused."
          },
          "2XX": {
            "description": "The delivery was received."
          }
        }
      }
    }
  },
  "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": {
      "Acceptance": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/AutoCompletedOption1"
          },
          {
            "type": "null"
          }
        ]
      },
      "Account": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "code",
              "name"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Account2": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "BANK",
              "CARD"
            ]
          }
        },
        "required": [
          "id",
          "displayName",
          "kind"
        ],
        "additionalProperties": false
      },
      "Account3": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "maxLength": 40
          },
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "type": {
            "type": "string",
            "enum": [
              "ASSET",
              "LIABILITY",
              "EQUITY",
              "REVENUE",
              "EXPENSE"
            ]
          },
          "gifiCode": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 4,
                "maxLength": 4
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "code",
          "name",
          "type",
          "gifiCode",
          "currency"
        ],
        "additionalProperties": false
      },
      "AccountOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          }
        },
        "required": [
          "id",
          "displayName",
          "currency"
        ],
        "additionalProperties": false
      },
      "AccumulatedAccount": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Account3"
          },
          {
            "type": "null"
          }
        ]
      },
      "Act": {
        "type": "string",
        "enum": [
          "bills.submit",
          "bills.approve",
          "bills.hold",
          "bills.releaseHold",
          "bills.addToRun",
          "bills.plan",
          "bills.unplan",
          "vendors.holdPayments",
          "vendors.releasePaymentHolds",
          "paymentRuns.cancelDrafts",
          "purchaseOrders.submit",
          "arrivals.notABill",
          "arrivals.handled"
        ]
      },
      "Active": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/ActiveOption1"
          },
          {
            "type": "null"
          }
        ]
      },
      "ActiveOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "state": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ACTIVE",
              "SUPERSEDED",
              "DISCARDED"
            ]
          },
          "definition": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DefinitionOption1"
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "AUTOMATION"
                  },
                  "trigger": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "entityId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "currency": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "condition": {
                    "$ref": "#/components/schemas/Condition2"
                  },
                  "actions": {
                    "minItems": 1,
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "operation": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "params": {
                          "$ref": "#/components/schemas/Params"
                        },
                        "input": {
                          "$ref": "#/components/schemas/Params"
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        }
                      },
                      "required": [
                        "operation",
                        "params",
                        "input",
                        "label"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "maxRunsPerDay": {
                    "default": 50,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  },
                  "amountCapMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "kind",
                  "trigger",
                  "entityId",
                  "currency",
                  "condition",
                  "actions",
                  "maxRunsPerDay",
                  "amountCapMinor"
                ],
                "additionalProperties": false
              }
            ]
          },
          "words": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "createdBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "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"
              }
            ]
          },
          "activatedAlone": {
            "type": "boolean"
          },
          "preview": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PreviewOption1"
              },
              {
                "type": "null"
              }
            ]
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "version",
          "state",
          "definition",
          "words",
          "createdBy",
          "createdAt",
          "activatedBy",
          "activatedAt",
          "activatedAlone",
          "preview",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "AddVendorContactResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "BILLING",
              "ACCOUNT_MANAGER",
              "ESCALATION",
              "REMITTANCE"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "slipConsent": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "state": {
                    "type": "string",
                    "enum": [
                      "NONE",
                      "GIVEN",
                      "WITHDRAWN",
                      "ADDRESS_CHANGED"
                    ]
                  },
                  "basis": {
                    "type": "string",
                    "enum": [
                      "WRITTEN",
                      "ELECTRONIC"
                    ]
                  },
                  "givenOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "email": {
                    "type": "string"
                  },
                  "recordedBy": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "recordedAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "withdrawnBy": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "withdrawnAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 20
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "state",
                  "basis",
                  "givenOn",
                  "email",
                  "recordedBy",
                  "recordedAt",
                  "withdrawnBy",
                  "withdrawnAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "email",
          "phone",
          "role",
          "note",
          "slipConsent"
        ],
        "additionalProperties": false
      },
      "Address": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "address": {
                "type": "string"
              },
              "label": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "address",
              "label"
            ],
            "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
      },
      "Advice": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/ListVendorNoticesResponseItem"
          },
          {
            "type": "null"
          }
        ]
      },
      "All": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/AllItem"
        },
        "minItems": 1
      },
      "All2": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/All2Item"
        },
        "minItems": 1
      },
      "All2Item": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/ConditionOption1"
          },
          {
            "type": "object",
            "properties": {
              "all": {
                "$ref": "#/components/schemas/All3"
              }
            },
            "required": [
              "all"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "any": {
                "$ref": "#/components/schemas/All3"
              }
            },
            "required": [
              "any"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "not": {
                "$ref": "#/components/schemas/ConditionOption1"
              }
            },
            "required": [
              "not"
            ],
            "additionalProperties": false
          }
        ]
      },
      "All3": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/ConditionOption1"
        },
        "minItems": 1
      },
      "AllItem": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/ConditionOption1"
          },
          {
            "type": "object",
            "properties": {
              "all": {
                "$ref": "#/components/schemas/All2"
              }
            },
            "required": [
              "all"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "any": {
                "$ref": "#/components/schemas/All2"
              }
            },
            "required": [
              "any"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "not": {
                "$ref": "#/components/schemas/All2Item"
              }
            },
            "required": [
              "not"
            ],
            "additionalProperties": false
          }
        ]
      },
      "AllItem2": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Condition2Option1"
          },
          {
            "type": "object",
            "properties": {
              "all": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AllItem3"
                }
              }
            },
            "required": [
              "all"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "any": {
                "minItems": 1,
                "maxItems": 20,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AllItem3"
                }
              }
            },
            "required": [
              "any"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "not": {
                "$ref": "#/components/schemas/AllItem3"
              }
            },
            "required": [
              "not"
            ],
            "additionalProperties": false
          }
        ]
      },
      "AllItem3": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Condition2Option1"
          },
          {
            "type": "object",
            "properties": {
              "all": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AllItem4"
                }
              }
            },
            "required": [
              "all"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "any": {
                "minItems": 1,
                "maxItems": 20,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AllItem4"
                }
              }
            },
            "required": [
              "any"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "not": {
                "$ref": "#/components/schemas/AllItem4"
              }
            },
            "required": [
              "not"
            ],
            "additionalProperties": false
          }
        ]
      },
      "AllItem4": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Condition2Option1"
          },
          {
            "type": "object",
            "properties": {
              "all": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Condition2Option1"
                }
              }
            },
            "required": [
              "all"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "any": {
                "minItems": 1,
                "maxItems": 20,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Condition2Option1"
                }
              }
            },
            "required": [
              "any"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "not": {
                "$ref": "#/components/schemas/Condition2Option1"
              }
            },
            "required": [
              "not"
            ],
            "additionalProperties": false
          }
        ]
      },
      "AnswerableBy": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "SETTINGS",
              "ADDRESS_WATCHER",
              "NOBODY"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "telephone": {
            "type": [
              "string",
              "null"
            ]
          },
          "replyTo": {
            "type": [
              "string",
              "null"
            ]
          },
          "settingsPersonWithoutSeat": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "state",
          "name",
          "telephone",
          "replyTo",
          "settingsPersonWithoutSeat"
        ],
        "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
      },
      "AppliedOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "billId": {
            "type": "string"
          },
          "vendorId": {
            "type": "string"
          },
          "vendorName": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "PROPOSED",
              "APPLIED",
              "ACCEPTED",
              "DECLINED",
              "SUPERSEDED"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "RESOLVER",
              "MODEL_READ"
            ]
          },
          "evidence": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "VENDOR_KEY",
                    "ALIAS_KEY",
                    "BUSINESS_NUMBER",
                    "SENDER_DOMAIN",
                    "PRINTED_ACCOUNT",
                    "NAME_RESEMBLES"
                  ]
                },
                "value": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "kind",
                "value"
              ],
              "additionalProperties": false
            }
          },
          "sentence": {
            "type": "string"
          },
          "promptVersion": {
            "type": [
              "string",
              "null"
            ]
          },
          "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"
              }
            ]
          },
          "declineReason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "billId",
          "vendorId",
          "vendorName",
          "state",
          "source",
          "evidence",
          "sentence",
          "promptVersion",
          "decidedBy",
          "decidedAt",
          "declineReason"
        ],
        "additionalProperties": false
      },
      "AppliesTo": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "PURCHASE_ORDER_LINE",
                "GOODS_RECEIPT_LINE",
                "BILL_LINE",
                "VENDOR_CREDIT_LINE",
                "INVOICE_LINE",
                "CREDIT_MEMO_LINE",
                "JOURNAL_LINE"
              ]
            }
          },
          {
            "type": "null"
          }
        ]
      },
      "AppliesTo2": {
        "minItems": 1,
        "maxItems": 7,
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "PURCHASE_ORDER_LINE",
            "GOODS_RECEIPT_LINE",
            "BILL_LINE",
            "VENDOR_CREDIT_LINE",
            "INVOICE_LINE",
            "CREDIT_MEMO_LINE",
            "JOURNAL_LINE"
          ]
        }
      },
      "ApproveBillSettlementResponse": {
        "type": "object",
        "properties": {
          "settlement": {
            "$ref": "#/components/schemas/ListBillSettlementsResponseItem"
          },
          "bill": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "paidBy": {
                "type": "string",
                "enum": [
                  "RUN",
                  "CARD",
                  "PAD",
                  "ACCOUNT",
                  "CHEQUE",
                  "WIRE",
                  "ETRANSFER",
                  "OTHER"
                ]
              },
              "openMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              }
            },
            "required": [
              "id",
              "status",
              "paidBy",
              "openMinor"
            ],
            "additionalProperties": false
          },
          "postingMoved": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "settlement",
          "bill",
          "postingMoved"
        ],
        "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
      },
      "ApprovedUnder": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "firingId": {
                "type": "string"
              },
              "authorityId": {
                "type": "string"
              },
              "approvedByName": {
                "type": "string"
              },
              "setByName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "origin": {
                "type": "string",
                "enum": [
                  "CARRIED_OVER",
                  "PERSON",
                  "IMPORT"
                ]
              },
              "scopeLabel": {
                "type": "string"
              },
              "entityName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "capMinor": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "currency": {
                "type": "string"
              },
              "firedAt": {
                "type": "string",
                "minLength": 20
              },
              "subject": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "BILL",
                      "ORDER",
                      "RUN"
                    ]
                  },
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "kind",
                  "id",
                  "number"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "firingId",
              "authorityId",
              "approvedByName",
              "setByName",
              "origin",
              "scopeLabel",
              "entityName",
              "capMinor",
              "currency",
              "firedAt"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "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
      },
      "Arrival": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "receivedAt": {
                "type": "string",
                "minLength": 20
              },
              "subject": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "receivedAt",
              "subject"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "AsOf": {
        "type": "object",
        "properties": {
          "position": {
            "type": "string",
            "pattern": "^(0|[1-9]\\d{0,18})$"
          },
          "at": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "ledgerPosition": {
            "type": "string",
            "pattern": "^(0|[1-9]\\d{0,18})$"
          },
          "freshness": {
            "type": "string",
            "enum": [
              "current",
              "behind",
              "held"
            ]
          },
          "waitedMs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "position",
          "at",
          "ledgerPosition",
          "freshness",
          "waitedMs"
        ],
        "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
      },
      "Auth": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "spf": {
                "type": "string",
                "enum": [
                  "PASS",
                  "FAIL",
                  "SOFTFAIL",
                  "NEUTRAL",
                  "NONE",
                  "TEMPERROR",
                  "PERMERROR",
                  "UNKNOWN"
                ]
              },
              "dkim": {
                "type": "string",
                "enum": [
                  "PASS",
                  "FAIL",
                  "SOFTFAIL",
                  "NEUTRAL",
                  "NONE",
                  "TEMPERROR",
                  "PERMERROR",
                  "UNKNOWN"
                ]
              },
              "dmarc": {
                "type": "string",
                "enum": [
                  "PASS",
                  "FAIL",
                  "SOFTFAIL",
                  "NEUTRAL",
                  "NONE",
                  "TEMPERROR",
                  "PERMERROR",
                  "UNKNOWN"
                ]
              }
            },
            "required": [
              "spf",
              "dkim",
              "dmarc"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "AutoCompletedOption1": {
        "type": "object",
        "properties": {
          "n": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "of": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "n",
          "of"
        ],
        "additionalProperties": false
      },
      "BankingSignals": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/StoredOption1"
        }
      },
      "Batch": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "invoiceCount": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "id",
              "invoiceCount"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Became": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "BILL",
                  "IMPORT_BATCH",
                  "FLAGGED"
                ]
              },
              "id": {
                "type": "string"
              },
              "label": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id",
              "label"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Became2": {
        "anyOf": [
          {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "BILL"
                  },
                  "billId": {
                    "type": "string"
                  },
                  "number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "supplierName": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "IN_REVIEW",
                      "DECLINED",
                      "APPROVED",
                      "HELD",
                      "OPEN",
                      "DUE",
                      "OVERDUE",
                      "IN_RUN",
                      "PARTIALLY_PAID",
                      "PAID",
                      "VOID"
                    ]
                  }
                },
                "required": [
                  "kind",
                  "billId",
                  "number",
                  "supplierName",
                  "status"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "CREDIT"
                  },
                  "vendorCreditId": {
                    "type": "string"
                  },
                  "number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "supplierName": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "IN_REVIEW",
                      "APPROVED",
                      "APPLIED",
                      "VOID"
                    ]
                  }
                },
                "required": [
                  "kind",
                  "vendorCreditId",
                  "number",
                  "supplierName",
                  "status"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "ANOMALY"
                  },
                  "proposalId": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "kind",
                  "proposalId",
                  "reason"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "IMPORT_BATCH"
                  },
                  "importId": {
                    "type": "string"
                  },
                  "fileName": {
                    "type": "string"
                  }
                },
                "required": [
                  "kind",
                  "importId",
                  "fileName"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "EARLIER_ARRIVAL"
                  },
                  "inboundEmailId": {
                    "type": "string"
                  },
                  "receivedAt": {
                    "type": "string",
                    "minLength": 20
                  }
                },
                "required": [
                  "kind",
                  "inboundEmailId",
                  "receivedAt"
                ],
                "additionalProperties": false
              }
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "Before": {
        "type": "object",
        "properties": {
          "billDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "dueDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "number": {
            "type": [
              "string",
              "null"
            ]
          },
          "vendorId": {
            "type": [
              "string",
              "null"
            ]
          },
          "totalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "taxMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          }
        },
        "required": [
          "billDate",
          "dueDate",
          "number",
          "vendorId",
          "totalMinor",
          "taxMinor"
        ],
        "additionalProperties": false
      },
      "BestCandidateOption1": {
        "type": "object",
        "properties": {
          "invoice": {
            "$ref": "#/components/schemas/MirrorOption1"
          },
          "grade": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "EXACT",
                  "LIKELY",
                  "NEAR"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "totalDifferenceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "unavailable": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "invoice",
          "grade",
          "days",
          "totalDifferenceMinor"
        ],
        "additionalProperties": false
      },
      "Bill": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "number": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplierName": {
            "type": "string"
          },
          "billDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "IN_REVIEW",
              "DECLINED",
              "APPROVED",
              "HELD",
              "OPEN",
              "DUE",
              "OVERDUE",
              "IN_RUN",
              "PARTIALLY_PAID",
              "PAID",
              "VOID"
            ]
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "subtotalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "taxMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "totalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "openMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          }
        },
        "required": [
          "id",
          "number",
          "supplierName",
          "billDate",
          "status",
          "currency",
          "subtotalMinor",
          "taxMinor",
          "totalMinor",
          "openMinor"
        ],
        "additionalProperties": false
      },
      "BillOption1": {
        "type": "object",
        "properties": {
          "billId": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "number": {
            "type": [
              "string",
              "null"
            ]
          },
          "billDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "IN_REVIEW",
              "DECLINED",
              "APPROVED",
              "HELD",
              "OPEN",
              "DUE",
              "OVERDUE",
              "IN_RUN",
              "PARTIALLY_PAID",
              "PAID",
              "VOID"
            ]
          },
          "totalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          }
        },
        "required": [
          "billId",
          "supplierName",
          "number",
          "billDate",
          "status",
          "totalMinor",
          "currency"
        ],
        "additionalProperties": false
      },
      "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
      },
      "Blocked": {
        "type": "object",
        "properties": {
          "answer": {
            "type": [
              "string",
              "null"
            ]
          },
          "assign": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolve": {
            "type": [
              "string",
              "null"
            ]
          },
          "setAside": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "answer",
          "assign",
          "resolve",
          "setAside"
        ],
        "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
      },
      "Budget": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "name",
              "version"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "BulkHoldVendorPaymentsRequest": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "PREVIEW",
              "RUN"
            ]
          },
          "selection": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "ids"
                  },
                  "ids": {
                    "minItems": 1,
                    "maxItems": 500,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": [
                  "kind",
                  "ids"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "filter"
                  },
                  "query": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "expectedTotal": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "query",
                  "expectedTotal"
                ],
                "additionalProperties": false
              }
            ]
          },
          "reason": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "until": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "on": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "note": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "confirmed": {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "totals": {
                "$ref": "#/components/schemas/Totals2"
              }
            },
            "required": [
              "count",
              "totals"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "mode",
          "selection"
        ],
        "additionalProperties": false
      },
      "BulkHoldVendorPaymentsResponse": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "const": "PREVIEW"
              },
              "act": {
                "$ref": "#/components/schemas/Act"
              },
              "matching": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "taken": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "eligible": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "entityId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "currency": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "minor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "href": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "label",
                    "entityId",
                    "currency",
                    "minor",
                    "href"
                  ],
                  "additionalProperties": false
                }
              },
              "skipped": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "sentence": {
                      "type": "string"
                    },
                    "href": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "label",
                    "code",
                    "sentence",
                    "href"
                  ],
                  "additionalProperties": false
                }
              },
              "figures": {
                "type": "object",
                "properties": {
                  "count": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "entries": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "totals": {
                    "$ref": "#/components/schemas/Totals2"
                  },
                  "basis": {
                    "type": "string",
                    "enum": [
                      "FUNCTIONAL_TOTAL",
                      "DOCUMENT_TOTAL",
                      "STILL_OWED",
                      "NONE"
                    ]
                  }
                },
                "required": [
                  "count",
                  "entries",
                  "totals",
                  "basis"
                ],
                "additionalProperties": false
              },
              "authority": {
                "anyOf": [
                  {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "authorityId": {
                          "type": "string"
                        },
                        "scopeLabel": {
                          "type": "string"
                        },
                        "entityId": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "capMinor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "usedMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "over": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "authorityId",
                        "scopeLabel",
                        "entityId",
                        "currency",
                        "capMinor",
                        "usedMinor",
                        "over"
                      ],
                      "additionalProperties": false
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "blocked": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string"
                      },
                      "sentence": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "code",
                      "sentence"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "confirm": {
                "type": "string"
              },
              "handoff": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "entityId": {
                        "type": "string"
                      },
                      "entityName": {
                        "type": "string"
                      },
                      "ids": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "entityId",
                      "entityName",
                      "ids"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "mode",
              "act",
              "matching",
              "taken",
              "eligible",
              "skipped",
              "figures",
              "authority",
              "blocked",
              "confirm",
              "handoff"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "const": "RUN"
              },
              "act": {
                "$ref": "#/components/schemas/Act"
              },
              "rows": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "DONE",
                        "REFUSED",
                        "NOT_ATTEMPTED"
                      ]
                    },
                    "code": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "sentence": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "href": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "label",
                    "outcome",
                    "code",
                    "sentence",
                    "href"
                  ],
                  "additionalProperties": false
                }
              },
              "done": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "refused": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "notAttempted": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "mode",
              "act",
              "rows",
              "done",
              "refused",
              "notAttempted"
            ],
            "additionalProperties": false
          }
        ]
      },
      "Candidate": {
        "type": "object",
        "properties": {
          "billId": {
            "type": "string"
          },
          "number": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 60
              },
              {
                "type": "null"
              }
            ]
          },
          "billDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "entityId": {
            "type": "string"
          },
          "vendorId": {
            "type": "string"
          },
          "deliveryRegion": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 6
              },
              {
                "type": "null"
              }
            ]
          },
          "supplierRegion": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 6
              },
              {
                "type": "null"
              }
            ]
          },
          "supplierCountry": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "billId",
          "number",
          "billDate",
          "currency",
          "entityId",
          "vendorId",
          "deliveryRegion",
          "supplierRegion",
          "supplierCountry"
        ],
        "additionalProperties": false
      },
      "Candidate2": {
        "type": "object",
        "properties": {
          "treatment": {
            "type": "string",
            "enum": [
              "STANDARD",
              "ZERO_RATED",
              "EXEMPT",
              "OUT_OF_SCOPE",
              "RELIEVED"
            ]
          },
          "placeOfSupply": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 6
              },
              {
                "type": "null"
              }
            ]
          },
          "selfAssessed": {
            "type": "boolean"
          },
          "itcEligible": {
            "type": "boolean"
          },
          "itcKind": {
            "type": "string",
            "enum": [
              "GENERAL",
              "MEALS_ENTERTAINMENT",
              "PASSENGER_VEHICLE",
              "ZERO_EMISSION_VEHICLE",
              "EXEMPT_ACTIVITY",
              "NONE"
            ]
          },
          "itcRecoverableBp": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 10000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "treatment",
          "placeOfSupply",
          "selfAssessed",
          "itcEligible",
          "itcKind",
          "itcRecoverableBp"
        ],
        "additionalProperties": false
      },
      "Candidates": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "journalLineId": {
              "type": "string"
            },
            "entryId": {
              "type": "string"
            },
            "entryNumber": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            },
            "entryRef": {
              "type": "string"
            },
            "occurredOn": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "amountMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "memo": {
              "type": [
                "string",
                "null"
              ]
            },
            "counterparty": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "journalLineId",
            "entryId",
            "entryNumber",
            "entryRef",
            "occurredOn",
            "amountMinor",
            "currency",
            "memo",
            "counterparty"
          ],
          "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
      },
      "Capabilities": {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "transactions.pull",
            "transactions.resume",
            "coa.pull",
            "balances.pull",
            "webhook.receive",
            "file.ingest",
            "invoices.pull",
            "contracts.pull",
            "payables.pull",
            "payouts.send"
          ]
        }
      },
      "Caps": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "entityId": {
              "type": "string"
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "capMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          "required": [
            "entityId",
            "currency",
            "capMinor"
          ],
          "additionalProperties": false
        }
      },
      "Cards": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "registration": {
              "$ref": "#/components/schemas/CreateTaxRegistrationResponse"
            },
            "asOf": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "timeZone": {
              "type": "string"
            },
            "period": {
              "$ref": "#/components/schemas/Window"
            },
            "state": {
              "type": "string",
              "enum": [
                "OPEN",
                "DRAFT",
                "REVIEWED",
                "APPROVED",
                "FILED"
              ]
            },
            "returnId": {
              "type": [
                "string",
                "null"
              ]
            },
            "dueOn": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "paymentDueOn": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "generalDueOn": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "individualBasis": {
              "type": "boolean"
            },
            "daysUntilDue": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "line101Minor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "line103Minor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "line106Minor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "line109Minor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "line104Minor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "line105Minor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "line107Minor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "line108Minor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "unresolvedCount": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "postedLineCount": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "taxFxUnclearedMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          "required": [
            "registration",
            "asOf",
            "timeZone",
            "period",
            "state",
            "returnId",
            "dueOn",
            "paymentDueOn",
            "generalDueOn",
            "individualBasis",
            "daysUntilDue",
            "line101Minor",
            "line103Minor",
            "line106Minor",
            "line109Minor",
            "unresolvedCount",
            "postedLineCount",
            "taxFxUnclearedMinor"
          ],
          "additionalProperties": false
        }
      },
      "CarriedFrom": {
        "description": "Where the line's values were carried from: the source line's kind, a colon and its id (\"PURCHASE_ORDER_LINE:ln_1\"), or null when the caller sent every value itself.",
        "x-stability-level": "beta",
        "type": [
          "string",
          "null"
        ]
      },
      "Cause": {
        "type": "string",
        "enum": [
          "OWED_NOT_LISTED",
          "OWED_LISTED_NOT_YET_IN_BOOKS",
          "OWED_UNDER_ANOTHER_NAME",
          "OWED_SUPPLIER_ARCHIVED",
          "OWED_NOT_PLACED",
          "LISTED_TWICE",
          "LISTED_NOT_IN_BOOKS",
          "NAME_PAIR_READ",
          "ROW_HELD",
          "CREDIT_ROW",
          "BALANCE_CHANGED_BY_HAND",
          "TOTAL_REMAINDER",
          "TRIAL_BALANCE_DIFFERS",
          "POSTED_DIFFERS_FROM_FILE",
          "NOTE_READ",
          "OWED_NO_BANKING",
          "OWED_BANKING_FILE_IN_REVIEW",
          "OWED_BANKING_WAITING",
          "BANKING_ROW_UNKNOWN_SUPPLIER",
          "BANKING_DIFFERS_FROM_VERIFIED",
          "CONVERSION_ROWS_NOT_POSTED"
        ]
      },
      "Cells": {
        "type": "object",
        "propertyNames": {
          "$ref": "#/components/schemas/MappingValue"
        },
        "additionalProperties": {
          "type": "string"
        }
      },
      "Cells2": {
        "type": "object",
        "propertyNames": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "pattern": "^(?:[a-z][A-Za-z0-9]*|cf\\.[a-z][a-z0-9_]{0,39}|line\\.[a-z][a-z0-9_]{0,39})$"
        },
        "additionalProperties": {
          "type": "string",
          "maxLength": 500
        }
      },
      "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
          }
        ]
      },
      "Changes": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "key": {
              "type": "string",
              "minLength": 1
            },
            "kind": {
              "type": "string",
              "enum": [
                "objectType",
                "dimensionType",
                "recordField",
                "lineField",
                "rule"
              ]
            },
            "verb": {
              "type": "string",
              "enum": [
                "add",
                "change",
                "archive",
                "restore"
              ]
            },
            "label": {
              "type": "string"
            },
            "type": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "TEXT",
                    "NUMBER",
                    "DATE",
                    "CHOICE",
                    "CHECKBOX",
                    "MONEY",
                    "MULTI_CHOICE",
                    "REFERENCE"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "fields": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "byDependency": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "key",
            "kind",
            "verb",
            "label",
            "type",
            "fields",
            "byDependency"
          ],
          "additionalProperties": false
        }
      },
      "Check": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "taxNumber": {
            "type": "string"
          },
          "legalNameChecked": {
            "type": "string"
          },
          "confirmedFor": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "REGISTERED",
              "NOT_REGISTERED",
              "NO_MATCH"
            ]
          },
          "evidence": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string"
                  },
                  "fileName": {
                    "type": "string"
                  }
                },
                "required": [
                  "documentId",
                  "fileName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "evidenceRead": {
            "type": "string",
            "enum": [
              "AGREES",
              "DIFFERS",
              "NOT_READ",
              "NO_EVIDENCE"
            ]
          },
          "evidenceReadPromptVersion": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "checkedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "checkedAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "taxNumber",
          "legalNameChecked",
          "confirmedFor",
          "outcome",
          "evidence",
          "evidenceRead",
          "evidenceReadPromptVersion",
          "note",
          "checkedBy",
          "checkedAt"
        ],
        "additionalProperties": false
      },
      "Choices": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChoicesOption1Item"
            }
          },
          {
            "type": "null"
          }
        ]
      },
      "Choices2": {
        "minItems": 1,
        "maxItems": 100,
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/ChoicesOption1Item"
        }
      },
      "ChoicesOption1Item": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          }
        },
        "required": [
          "value",
          "label"
        ],
        "additionalProperties": false
      },
      "Clearing": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "NOT_PROPOSED",
              "PARTIALLY_POSTED",
              "UNPROVEN",
              "ZEROED",
              "OUT_OF_BALANCE"
            ]
          },
          "balanceMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "accountSource": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "BATCH",
                  "REGISTRATION"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "postedComponents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "proposedComponents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "totalComponents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "state",
          "balanceMinor",
          "accountSource",
          "postedComponents",
          "proposedComponents",
          "totalComponents"
        ],
        "additionalProperties": false
      },
      "CloseChecklistResponse": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "periodYear": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodMonth": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodEnd": {
            "type": "string"
          },
          "started": {
            "type": "boolean"
          },
          "tasks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "BANK_RECONCILIATION",
                    "STRIPE_RECONCILIATION",
                    "PROPOSAL_QUEUE_CLEARED",
                    "ACCRUALS_REVIEWED",
                    "FLUX_REVIEWED",
                    "TAX_RETURN_GENERATED",
                    "PERIOD_LOCKED",
                    "CUSTOM",
                    "CLEARING_ACCOUNTS_ZERO",
                    "BALANCE_SHEET_CERTIFIED",
                    "PAYABLES_TIED_OUT",
                    "PURCHASES_OPEN_ITEMS",
                    "CUSTOMER_CREDIT_BALANCES",
                    "ALLOWANCE",
                    "FX_REVALUATION",
                    "EXEMPTION_CERTIFICATES_EXPIRING",
                    "RECEIVED_NOT_INVOICED",
                    "EXPECTED_BILLS_ACCOUNTED"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "PENDING",
                    "IN_PROGRESS",
                    "DONE",
                    "BLOCKED"
                  ]
                },
                "derived": {
                  "type": "boolean"
                },
                "evidence": {
                  "type": "string"
                },
                "completedByName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "completedAt": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "drill": {
                  "anyOf": [
                    {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "BILLS_OPEN_IN_PERIOD"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "closePeriod": {
                              "type": "string",
                              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                            },
                            "count": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "kind",
                            "entityId",
                            "closePeriod",
                            "count"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "PAYABLE_ACCOUNTS"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "asOf": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "accounts": {
                              "minItems": 1,
                              "maxItems": 5,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "accountId": {
                                    "type": "string"
                                  },
                                  "code": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "differenceMinor": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "accountId",
                                  "code",
                                  "name",
                                  "differenceMinor"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "kind",
                            "entityId",
                            "asOf",
                            "accounts"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "CUSTOMERS_IN_CREDIT"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "asOf": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "reversesOn": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "currency": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 3
                            },
                            "count": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "totalMinor": {
                              "type": "string"
                            },
                            "customers": {
                              "minItems": 1,
                              "maxItems": 10,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "customerId": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  },
                                  "creditMinor": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "customerId",
                                  "displayName",
                                  "creditMinor"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "depositsAccount": {
                              "$ref": "#/components/schemas/DepositsAccount"
                            },
                            "receivableAccount": {
                              "$ref": "#/components/schemas/DepositsAccount"
                            },
                            "proposal": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "entryId": {
                                      "type": "string"
                                    },
                                    "status": {
                                      "type": "string"
                                    },
                                    "amountMinor": {
                                      "type": "string"
                                    },
                                    "current": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "entryId",
                                    "status",
                                    "amountMinor",
                                    "current"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "refusal": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "entityId",
                            "asOf",
                            "reversesOn",
                            "currency",
                            "count",
                            "totalMinor",
                            "customers",
                            "depositsAccount",
                            "receivableAccount",
                            "proposal",
                            "refusal"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "ALLOWANCE"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "asOf": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "currency": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 3
                            },
                            "method": {
                              "type": "string",
                              "enum": [
                                "AGEING_BUCKETS",
                                "SPECIFIC_PROVISIONS",
                                "COMBINED"
                              ]
                            },
                            "targetMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "balanceMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "changeMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "buckets": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "bucket": {
                                    "type": "string",
                                    "enum": [
                                      "CURRENT",
                                      "D1_TO_30",
                                      "D31_TO_60",
                                      "D61_TO_90",
                                      "OVER_90"
                                    ]
                                  },
                                  "balanceMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "basisPoints": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "allowanceMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  }
                                },
                                "required": [
                                  "bucket",
                                  "balanceMinor",
                                  "basisPoints",
                                  "allowanceMinor"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "provisions": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "count": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "totalMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "customers": {
                                      "maxItems": 10,
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "customerId": {
                                            "type": "string"
                                          },
                                          "displayName": {
                                            "type": "string"
                                          },
                                          "amountMinor": {
                                            "type": "string",
                                            "pattern": "^-?\\d+$"
                                          }
                                        },
                                        "required": [
                                          "customerId",
                                          "displayName",
                                          "amountMinor"
                                        ],
                                        "additionalProperties": false
                                      }
                                    }
                                  },
                                  "required": [
                                    "count",
                                    "totalMinor",
                                    "customers"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "allowanceAccount": {
                              "$ref": "#/components/schemas/DepositsAccount"
                            },
                            "badDebtAccount": {
                              "$ref": "#/components/schemas/DepositsAccount"
                            },
                            "proposal": {
                              "$ref": "#/components/schemas/Proposal"
                            },
                            "refusal": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "entityId",
                            "asOf",
                            "currency",
                            "method",
                            "targetMinor",
                            "balanceMinor",
                            "changeMinor",
                            "buckets",
                            "provisions",
                            "allowanceAccount",
                            "badDebtAccount",
                            "proposal",
                            "refusal"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "FX_REVALUATION"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "asOf": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "reversesOn": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "functionalCurrency": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 3
                            },
                            "currencies": {
                              "minItems": 1,
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "currency": {
                                    "type": "string",
                                    "minLength": 3,
                                    "maxLength": 3
                                  },
                                  "documents": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "openMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "carryingMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "rate": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "rateDate": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "rateSource": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "revaluedMinor": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^-?\\d+$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "adjustmentMinor": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "pattern": "^-?\\d+$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "problem": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "detail": {
                                            "type": "string"
                                          },
                                          "remedy": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "detail",
                                          "remedy"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "currency",
                                  "documents",
                                  "openMinor",
                                  "carryingMinor",
                                  "rate",
                                  "rateDate",
                                  "rateSource",
                                  "revaluedMinor",
                                  "adjustmentMinor",
                                  "problem"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "adjustmentMinor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "receivableAccount": {
                              "$ref": "#/components/schemas/DepositsAccount"
                            },
                            "unrealizedFxAccount": {
                              "$ref": "#/components/schemas/DepositsAccount"
                            },
                            "proposal": {
                              "$ref": "#/components/schemas/Proposal"
                            },
                            "refusal": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "entityId",
                            "asOf",
                            "reversesOn",
                            "functionalCurrency",
                            "currencies",
                            "adjustmentMinor",
                            "receivableAccount",
                            "unrealizedFxAccount",
                            "proposal",
                            "refusal"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "CERTIFICATES_EXPIRING"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "from": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "to": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "count": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "renewed": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "certificates": {
                              "minItems": 1,
                              "maxItems": 10,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "certificateId": {
                                    "type": "string"
                                  },
                                  "customerId": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  },
                                  "scope": {
                                    "type": "string",
                                    "enum": [
                                      "PROVINCIAL_SALES_TAX",
                                      "GST_HST_RELIEF",
                                      "NON_RESIDENT_STATUS",
                                      "EXPORT_PROOF",
                                      "INDIAN_ACT_S87"
                                    ]
                                  },
                                  "jurisdiction": {
                                    "type": "string"
                                  },
                                  "expiresOn": {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  "renewed": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "certificateId",
                                  "customerId",
                                  "displayName",
                                  "scope",
                                  "jurisdiction",
                                  "expiresOn",
                                  "renewed"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "kind",
                            "entityId",
                            "from",
                            "to",
                            "count",
                            "renewed",
                            "certificates"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "RECEIVED_NOT_INVOICED"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "asOf": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "reversesOn": {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            "currency": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            "totalMinor": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "orderCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "lineCount": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "orders": {
                              "maxItems": 5,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "orderId": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "vendorName": {
                                    "type": "string"
                                  },
                                  "rniMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  }
                                },
                                "required": [
                                  "orderId",
                                  "number",
                                  "vendorName",
                                  "rniMinor"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "account": {
                              "$ref": "#/components/schemas/Account"
                            },
                            "proposal": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "entryId": {
                                      "type": "string"
                                    },
                                    "status": {
                                      "type": "string"
                                    },
                                    "amountMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "current": {
                                      "type": "boolean"
                                    },
                                    "declinedReason": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    },
                                    "declinedByName": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "entryId",
                                    "status",
                                    "amountMinor",
                                    "current",
                                    "declinedReason",
                                    "declinedByName"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "refusal": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "entityId",
                            "asOf",
                            "reversesOn",
                            "currency",
                            "totalMinor",
                            "orderCount",
                            "lineCount",
                            "orders",
                            "account",
                            "proposal",
                            "refusal"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "EXPECTED_BILLS"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "month": {
                              "type": "string",
                              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                            },
                            "monthLabel": {
                              "type": "string"
                            },
                            "waiting": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "arrived": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "accrued": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "dismissed": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "names": {
                              "maxItems": 3,
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "waitingTotals": {
                              "$ref": "#/components/schemas/WaitingTotals"
                            },
                            "checkedPastEnd": {
                              "type": "boolean"
                            },
                            "lastCheckedOn": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "entityId",
                            "month",
                            "monthLabel",
                            "waiting",
                            "arrived",
                            "accrued",
                            "dismissed",
                            "names",
                            "waitingTotals",
                            "checkedPastEnd",
                            "lastCheckedOn"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "kind",
                "title",
                "status",
                "derived",
                "evidence",
                "completedByName",
                "completedAt",
                "drill"
              ],
              "additionalProperties": false
            }
          },
          "done": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "blocked": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "outstanding": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "ready": {
            "type": "boolean"
          },
          "openQuestions": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "entityId",
          "entityName",
          "periodYear",
          "periodMonth",
          "periodEnd",
          "started",
          "tasks",
          "done",
          "blocked",
          "outstanding",
          "ready",
          "openQuestions"
        ],
        "additionalProperties": false
      },
      "ClosePurchaseOrderResponse": {
        "type": "object",
        "properties": {
          "purchaseOrderId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "IN_APPROVAL",
              "APPROVED",
              "SENT",
              "PART_RECEIVED",
              "RECEIVED",
              "CLOSED",
              "CANCELLED"
            ]
          },
          "closed": {
            "$ref": "#/components/schemas/Closed"
          }
        },
        "required": [
          "purchaseOrderId",
          "status",
          "closed"
        ],
        "additionalProperties": false
      },
      "Closed": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "by": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "at": {
                "type": "string",
                "minLength": 20
              },
              "reason": {
                "type": "string"
              },
              "short": {
                "type": "boolean"
              }
            },
            "required": [
              "by",
              "at",
              "reason",
              "short"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "ClosedBy": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string"
          },
          "lockedByName": {
            "type": "string"
          },
          "lockedAt": {
            "type": "string",
            "minLength": 20
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "label",
          "lockedByName",
          "lockedAt",
          "reason"
        ],
        "additionalProperties": false
      },
      "Closing": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "closesAt": {
                "type": "string",
                "minLength": 20
              },
              "closesOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "setBy": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "setAt": {
                "type": "string",
                "minLength": 20
              },
              "reason": {
                "type": "string"
              },
              "successor": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "address": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "address"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "closesAt",
              "closesOn",
              "setBy",
              "setAt",
              "reason",
              "successor"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Closure": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "RESOLVED",
                  "SET_ASIDE"
                ]
              },
              "by": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "at": {
                "type": "string",
                "minLength": 20
              },
              "note": {
                "type": "string"
              }
            },
            "required": [
              "status",
              "by",
              "at",
              "note"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "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"
        ]
      },
      "Commentary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "companyName": {
            "type": "string"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "periodYear": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodMonth": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12
          },
          "periodLabel": {
            "type": "string"
          },
          "monthEnd": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "priorMonthEnd": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "cutOffDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "state": {
            "type": "string",
            "enum": [
              "DRAFT",
              "APPROVED",
              "SUPERSEDED"
            ]
          },
          "readBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "readAt": {
            "type": "string",
            "minLength": 20
          },
          "booksLockedAtRead": {
            "type": "boolean"
          },
          "approved": {
            "$ref": "#/components/schemas/Decision2"
          },
          "superseded": {
            "$ref": "#/components/schemas/StoppedBy"
          },
          "newerId": {
            "type": [
              "string",
              "null"
            ]
          },
          "headline": {
            "type": "object",
            "properties": {
              "owedMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "changeMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "unexplainedMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "spendMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "heldBillCount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "owedMinor",
              "changeMinor",
              "unexplainedMinor",
              "spendMinor",
              "heldBillCount"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "entityId",
          "companyName",
          "entityTimeZone",
          "periodYear",
          "periodMonth",
          "periodLabel",
          "monthEnd",
          "priorMonthEnd",
          "currency",
          "cutOffDays",
          "state",
          "readBy",
          "readAt",
          "booksLockedAtRead",
          "approved",
          "superseded",
          "newerId",
          "headline"
        ],
        "additionalProperties": false
      },
      "CommittedOption1": {
        "type": "object",
        "properties": {
          "amountMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          }
        },
        "required": [
          "amountMinor",
          "currency"
        ],
        "additionalProperties": false
      },
      "Common": {
        "type": "object",
        "properties": {
          "language": {
            "type": "string",
            "enum": [
              "en",
              "fr"
            ]
          },
          "companyName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "vendorName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "recipientName": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ]
          },
          "contact": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "telephone": {
                "type": "string"
              },
              "replyTo": {
                "type": "string",
                "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,}$"
              },
              "source": {
                "type": "string",
                "enum": [
                  "SETTINGS",
                  "ADDRESS_WATCHER"
                ]
              }
            },
            "required": [
              "name",
              "telephone",
              "replyTo",
              "source"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "language",
          "companyName",
          "vendorName",
          "recipientName",
          "contact"
        ],
        "additionalProperties": false
      },
      "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
        }
      },
      "ComposeQuestionDigestResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": [
              "string",
              "null"
            ]
          },
          "questionCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "text": {
            "type": "string"
          },
          "composedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "composedAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "entityId",
          "questionCount",
          "text",
          "composedBy",
          "composedAt"
        ],
        "additionalProperties": false
      },
      "Condition": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/ConditionOption1"
          },
          {
            "type": "object",
            "properties": {
              "all": {
                "$ref": "#/components/schemas/All"
              }
            },
            "required": [
              "all"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "any": {
                "$ref": "#/components/schemas/All"
              }
            },
            "required": [
              "any"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "not": {
                "$ref": "#/components/schemas/AllItem"
              }
            },
            "required": [
              "not"
            ],
            "additionalProperties": false
          }
        ],
        "description": "A group {all: [...]}, {any: [...]} or {not: condition}, or a comparison {field, op, value | otherField}. field is cf.<key> for a custom field or the name of a standard field. op is isBlank, isNotBlank, equals, notEquals, greaterThan, atLeast, lessThan, atMost, oneOf, noneOf, contains or changed. Groups nest 3 levels deep, with 20 comparisons at most.",
        "examples": [
          {
            "all": [
              {
                "field": "totalMinor",
                "op": "greaterThan",
                "value": "1000000"
              },
              {
                "field": "cf.project",
                "op": "isBlank"
              }
            ]
          }
        ]
      },
      "Condition2": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Condition2Option1"
          },
          {
            "type": "object",
            "properties": {
              "all": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AllItem2"
                }
              }
            },
            "required": [
              "all"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "any": {
                "minItems": 1,
                "maxItems": 20,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AllItem2"
                }
              }
            },
            "required": [
              "any"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "not": {
                "$ref": "#/components/schemas/AllItem2"
              }
            },
            "required": [
              "not"
            ],
            "additionalProperties": false
          }
        ]
      },
      "Condition2Option1": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "op": {
            "type": "string",
            "enum": [
              "isBlank",
              "isNotBlank",
              "equals",
              "notEquals",
              "greaterThan",
              "atLeast",
              "lessThan",
              "atMost",
              "oneOf",
              "noneOf",
              "contains",
              "changed"
            ]
          },
          "value": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "boolean"
              },
              {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 200
                }
              }
            ]
          },
          "otherField": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          }
        },
        "required": [
          "field",
          "op"
        ],
        "additionalProperties": false
      },
      "ConditionOption1": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "pattern": "^(cf\\.[a-z][a-z0-9_]{0,39}|dim\\.[A-Z][A-Z0-9_]{0,39}|[a-z][A-Za-z0-9]{0,39})$"
          },
          "op": {
            "type": "string",
            "enum": [
              "isBlank",
              "isNotBlank",
              "equals",
              "notEquals",
              "greaterThan",
              "atLeast",
              "lessThan",
              "atMost",
              "oneOf",
              "noneOf",
              "contains",
              "changed"
            ]
          },
          "value": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "boolean"
              },
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 500
                },
                "minItems": 1,
                "maxItems": 100
              }
            ]
          },
          "otherField": {
            "type": "string",
            "pattern": "^(cf\\.[a-z][a-z0-9_]{0,39}|dim\\.[A-Z][A-Z0-9_]{0,39}|[a-z][A-Za-z0-9]{0,39})$"
          }
        },
        "required": [
          "field",
          "op"
        ],
        "additionalProperties": false
      },
      "Conflicts": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "key": {
              "type": "string"
            },
            "kind": {
              "type": "string",
              "enum": [
                "objectType",
                "dimensionType",
                "recordField",
                "lineField",
                "rule"
              ]
            },
            "field": {
              "type": "string"
            },
            "reason": {
              "type": "string"
            },
            "resolvable": {
              "type": "boolean"
            }
          },
          "required": [
            "key",
            "kind",
            "field",
            "reason",
            "resolvable"
          ],
          "additionalProperties": false
        }
      },
      "Contact": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "SEATED",
              "FELL_BACK",
              "NOBODY"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "telephone": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "state",
          "name",
          "telephone"
        ],
        "additionalProperties": false
      },
      "ContactEmail": {
        "anyOf": [
          {
            "type": "string",
            "maxLength": 60,
            "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,}$"
          },
          {
            "type": "null"
          }
        ]
      },
      "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
        }
      },
      "ContactsItem": {
        "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,}$"
          },
          "phone": {
            "type": "string",
            "maxLength": 50
          },
          "role": {
            "type": "string",
            "enum": [
              "BILLING",
              "ACCOUNT_MANAGER",
              "ESCALATION",
              "REMITTANCE"
            ]
          },
          "note": {
            "type": "string",
            "maxLength": 500
          }
        },
        "required": [
          "name",
          "role"
        ],
        "additionalProperties": false
      },
      "Conversion": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "SAME_CURRENCY",
              "CONVERTED",
              "UNTESTED"
            ]
          },
          "functionalCurrency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "functionalTotalMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "fxRate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{1,6}\\.\\d{6}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "fxRateDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "fxSource": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "BOC_DAILY",
                  "ENTITY_POLICY",
                  "TYPED",
                  "BACKFILLED_FROM_ENTRY"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "state",
          "functionalCurrency",
          "functionalTotalMinor",
          "fxRate",
          "fxRateDate",
          "fxSource"
        ],
        "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
      },
      "Counts": {
        "type": "object",
        "properties": {
          "objectTypes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "fields": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "lineFields": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "rules": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "dimensionTypes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "objectTypes",
          "fields",
          "lineFields",
          "rules",
          "dimensionTypes"
        ],
        "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
      },
      "Counts3": {
        "type": "object",
        "properties": {
          "rows": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "clean": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "problems": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "lowConfidence": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "applied": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "refused": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "records": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "clean": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "problems": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "applied": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "refused": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "total",
              "clean",
              "problems",
              "applied",
              "refused"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "rows",
          "clean",
          "problems",
          "lowConfidence",
          "applied",
          "refused"
        ],
        "additionalProperties": false
      },
      "Counts4": {
        "type": "object",
        "properties": {
          "both": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "different": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "onlyTheirs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "onlyOurs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "uncheckedFigures": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "declines": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "both",
          "different",
          "onlyTheirs",
          "onlyOurs",
          "total",
          "uncheckedFigures",
          "declines"
        ],
        "additionalProperties": false
      },
      "CreateBudgetResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "fiscalYear": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "fiscalYearEndMonth": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 12
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "approved": {
            "type": "boolean"
          },
          "approvedByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "approvedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "accountId": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "periodYear": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "periodMonth": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 12
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                }
              },
              "required": [
                "accountId",
                "code",
                "name",
                "periodYear",
                "periodMonth",
                "amountMinor"
              ],
              "additionalProperties": false
            }
          },
          "totalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "name",
          "fiscalYear",
          "fiscalYearEndMonth",
          "currency",
          "version",
          "approved",
          "approvedByName",
          "approvedAt",
          "createdByName",
          "createdAt",
          "lines",
          "totalMinor"
        ],
        "additionalProperties": false
      },
      "CreateChartImportResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "format": {
            "type": "string",
            "enum": [
              "QBO",
              "SAGE50",
              "GENERIC"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "REVIEW",
              "APPROVED"
            ]
          },
          "rowCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "groupCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "skippedCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "uploadedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "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"
              }
            ]
          },
          "accountsCreated": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "dimensionValuesCreated": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "dimensionPoliciesCreated": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "declinedGroups": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "groups": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "base": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "ASSET",
                    "LIABILITY",
                    "EQUITY",
                    "REVENUE",
                    "EXPENSE"
                  ]
                },
                "gifiCode": {
                  "type": "string"
                },
                "gifiConfidence": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "members": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "lineNumber": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "code": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "suffix": {
                        "type": "string"
                      },
                      "dimensionValueCode": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "lineNumber",
                      "code",
                      "name",
                      "suffix",
                      "dimensionValueCode"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "key",
                "base",
                "code",
                "type",
                "gifiCode",
                "gifiConfidence",
                "members"
              ],
              "additionalProperties": false
            }
          },
          "skipped": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lineNumber": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "code": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "structure": {
                  "type": "string"
                }
              },
              "required": [
                "lineNumber",
                "code",
                "name",
                "structure"
              ],
              "additionalProperties": false
            }
          },
          "rows": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "lineNumber": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "code": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "ASSET",
                        "LIABILITY",
                        "EQUITY",
                        "REVENUE",
                        "EXPENSE"
                      ]
                    },
                    "suppliedGifi": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "suggestedGifi": {
                      "type": "string"
                    },
                    "suggestedGifiConfidence": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "suggestedGifiBasis": {
                      "type": "string"
                    },
                    "parentCode": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "groupKey": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "groupSuffix": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "lineNumber",
                    "code",
                    "name",
                    "type",
                    "suppliedGifi",
                    "suggestedGifi",
                    "suggestedGifiConfidence",
                    "suggestedGifiBasis",
                    "parentCode",
                    "groupKey",
                    "groupSuffix"
                  ],
                  "additionalProperties": false
                }
              },
              "nextCursor": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "total": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "data",
              "nextCursor",
              "total"
            ],
            "additionalProperties": false
          },
          "suggestedCodeCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "fileName",
          "format",
          "status",
          "rowCount",
          "groupCount",
          "skippedCount",
          "uploadedBy",
          "createdAt",
          "approvedBy",
          "approvedAt",
          "accountsCreated",
          "dimensionValuesCreated",
          "dimensionPoliciesCreated",
          "declinedGroups",
          "groups",
          "skipped",
          "rows",
          "suggestedCodeCount"
        ],
        "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
      },
      "CreateCustomFieldDefinitionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "recordKind": {
            "type": "string",
            "enum": [
              "CUSTOMER",
              "INVOICE",
              "CREDIT_MEMO",
              "PRODUCT",
              "CONTRACT",
              "VENDOR",
              "BILL",
              "PURCHASE_ORDER",
              "JOURNAL_ENTRY",
              "CUSTOM_OBJECT",
              "LINE"
            ]
          },
          "objectKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "TEXT",
              "NUMBER",
              "DATE",
              "CHOICE",
              "CHECKBOX",
              "MONEY",
              "MULTI_CHOICE",
              "REFERENCE"
            ]
          },
          "choices": {
            "$ref": "#/components/schemas/Choices"
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference": {
            "$ref": "#/components/schemas/Reference"
          },
          "required": {
            "type": "boolean"
          },
          "showOnDocument": {
            "type": "boolean"
          },
          "indexed": {
            "type": "boolean"
          },
          "indexState": {
            "type": "string",
            "enum": [
              "OFF",
              "BUILDING",
              "READY"
            ]
          },
          "indexJobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "appliesTo": {
            "$ref": "#/components/schemas/AppliesTo"
          },
          "position": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "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"
              }
            ]
          },
          "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",
          "recordKind",
          "objectKey",
          "key",
          "label",
          "description",
          "type",
          "choices",
          "currency",
          "reference",
          "required",
          "showOnDocument",
          "indexed",
          "appliesTo",
          "position",
          "archivedAt",
          "archivedBy",
          "createdBy",
          "createdAt",
          "updatedBy",
          "updatedAt"
        ],
        "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
          }
        ]
      },
      "CreateDimensionTypeResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "isSystem": {
            "type": "boolean"
          },
          "active": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "values": {
            "$ref": "#/components/schemas/Values"
          }
        },
        "required": [
          "id",
          "code",
          "label",
          "description",
          "isSystem",
          "active",
          "sortOrder",
          "values"
        ],
        "additionalProperties": false
      },
      "CreateHandoffResponse": {
        "type": "object",
        "properties": {
          "notice": {
            "$ref": "#/components/schemas/ListVendorNoticesResponseItem"
          }
        },
        "required": [
          "notice"
        ],
        "additionalProperties": false
      },
      "CreateIntakeLinkResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "LIVE",
              "FULL",
              "EXPIRED",
              "REVOKED"
            ]
          },
          "createdBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "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"
            ]
          },
          "acceptedToday": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "acceptedTotal": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lastSubmittedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "label",
          "state",
          "createdBy",
          "createdAt",
          "expiresAt",
          "revokedAt",
          "revokedBy",
          "revokeReason",
          "acceptedToday",
          "acceptedTotal",
          "lastSubmittedAt",
          "url"
        ],
        "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
      },
      "CreatePaymentPlanResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "account": {
            "$ref": "#/components/schemas/AccountOption1"
          },
          "state": {
            "type": "string",
            "enum": [
              "PROPOSED",
              "APPLIED",
              "DISCARDED",
              "EXPIRED"
            ]
          },
          "asOf": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "throughDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "keepMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "balanceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "readBy": {
            "type": "string",
            "enum": [
              "FORM",
              "PRODUCT",
              "MODEL"
            ]
          },
          "promptVersion": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "expiresAt": {
            "type": "string",
            "minLength": 20
          },
          "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"
              }
            ]
          },
          "moreBills": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "totals": {
            "type": "object",
            "properties": {
              "plannedCount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "plannedMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "leftOutCount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "leftOutMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "keptDiscountMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "afterPlanBalanceMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              }
            },
            "required": [
              "plannedCount",
              "plannedMinor",
              "leftOutCount",
              "leftOutMinor",
              "keptDiscountMinor",
              "afterPlanBalanceMinor"
            ],
            "additionalProperties": false
          },
          "runways": {
            "type": "object",
            "properties": {
              "today": {
                "$ref": "#/components/schemas/RunwayOption1"
              },
              "withPlan": {
                "$ref": "#/components/schemas/RunwayOption1"
              }
            },
            "required": [
              "today",
              "withPlan"
            ],
            "additionalProperties": false
          },
          "lines": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "position": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "bill": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "href": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "number",
                    "href"
                  ],
                  "additionalProperties": false
                },
                "vendor": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "displayName"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "openMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "currency": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$"
                },
                "dueOn": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "tier": {
                  "anyOf": [
                    {
                      "type": "number",
                      "const": 1
                    },
                    {
                      "type": "number",
                      "const": 2
                    },
                    {
                      "type": "number",
                      "const": 3
                    }
                  ]
                },
                "discount": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "minor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "closesOn": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        }
                      },
                      "required": [
                        "minor",
                        "closesOn"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "interestPerDayMinor": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "proposedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "reason": {
                  "type": "string",
                  "enum": [
                    "DISCOUNT_KEPT",
                    "ON_DUE_DATE",
                    "ALREADY_DUE",
                    "YOUR_DATE",
                    "CASH_SHORT",
                    "NOT_PAYABLE",
                    "POSSIBLE_DUPLICATE",
                    "YOUR_EXCLUSION",
                    "DECLINED_BEFORE"
                  ]
                },
                "decision": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "APPLIED",
                        "CHANGED",
                        "DECLINED"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "decidedOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "declineClass": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "NOT_NOW",
                        "DISPUTED",
                        "PAID_OTHER_WAY",
                        "OTHER"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "declineNote": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "findings": {
                  "$ref": "#/components/schemas/Findings"
                }
              },
              "required": [
                "id",
                "position",
                "bill",
                "vendor",
                "openMinor",
                "currency",
                "dueOn",
                "tier",
                "discount",
                "interestPerDayMinor",
                "proposedOn",
                "reason",
                "decision",
                "decidedOn",
                "declineClass",
                "declineNote",
                "findings"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "entityTimeZone",
          "account",
          "state",
          "asOf",
          "throughDate",
          "keepMinor",
          "balanceMinor",
          "readBy",
          "promptVersion",
          "createdBy",
          "createdAt",
          "expiresAt",
          "decidedBy",
          "decidedAt",
          "moreBills",
          "totals",
          "runways",
          "lines"
        ],
        "additionalProperties": false
      },
      "CreatePurchaseOrderResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "number": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "IN_APPROVAL",
              "APPROVED",
              "SENT",
              "PART_RECEIVED",
              "RECEIVED",
              "CLOSED",
              "CANCELLED"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "MANUAL",
              "QUOTE_READ",
              "PATTERN",
              "IMPORT"
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "entity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "entityTimeZone": {
            "type": "string"
          },
          "vendor": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "displayName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "supplierReference": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "totalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "functionalTotalMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "lineCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "expectedBy": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "requestedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "submittedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "sentAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "declined": {
            "$ref": "#/components/schemas/Retired"
          },
          "customFields": {
            "$ref": "#/components/schemas/CustomFields2"
          },
          "deliveryNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "memo": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "$ref": "#/components/schemas/Lines6"
          },
          "gaps": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "quote": {
            "$ref": "#/components/schemas/Quote"
          },
          "pattern": {
            "$ref": "#/components/schemas/Pattern"
          },
          "counts": {
            "type": "object",
            "properties": {
              "audit": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "audit"
            ],
            "additionalProperties": false
          },
          "closed": {
            "$ref": "#/components/schemas/Closed"
          },
          "noticeOwed": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "number",
          "status",
          "source",
          "revision",
          "entity",
          "entityTimeZone",
          "vendor",
          "supplierReference",
          "currency",
          "totalMinor",
          "functionalTotalMinor",
          "lineCount",
          "expectedBy",
          "orderDate",
          "createdAt",
          "requestedBy",
          "submittedAt",
          "sentAt",
          "declined",
          "deliveryNote",
          "memo",
          "lines",
          "gaps",
          "quote",
          "pattern",
          "counts",
          "closed",
          "noticeOwed"
        ],
        "additionalProperties": false
      },
      "CreateTaxRegistrationResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "taxType": {
            "type": "string",
            "enum": [
              "GST_HST",
              "QST",
              "PST_BC",
              "PST_SK",
              "PST_MB",
              "US_SALES_TAX"
            ]
          },
          "registrationNumber": {
            "type": "string"
          },
          "region": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(CA|US)-[A-Z]{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "filingFrequency": {
            "type": "string",
            "enum": [
              "MONTHLY",
              "QUARTERLY",
              "ANNUAL"
            ]
          },
          "fiscalYearEndMonth": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12
          },
          "effectiveFrom": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "effectiveTo": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "collectedAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "recoverableAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "instalmentAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "rebateAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "exchangeDifferenceAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "label": {
            "type": "string"
          },
          "frequencyHistory": {
            "$ref": "#/components/schemas/FrequencyHistory"
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "taxType",
          "registrationNumber",
          "region",
          "filingFrequency",
          "fiscalYearEndMonth",
          "effectiveFrom",
          "effectiveTo",
          "collectedAccount",
          "recoverableAccount",
          "instalmentAccount",
          "rebateAccount",
          "exchangeDifferenceAccount",
          "label",
          "frequencyHistory"
        ],
        "additionalProperties": false
      },
      "CreateVendorCreditResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "vendorId": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "IN_REVIEW",
              "APPROVED",
              "APPLIED",
              "VOID"
            ]
          },
          "remainingMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "entryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entryNumber": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "moved": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "billId": {
                  "type": "string"
                },
                "from": {
                  "type": "string",
                  "enum": [
                    "APPROVED",
                    "PARTIALLY_PAID",
                    "PAID"
                  ]
                },
                "to": {
                  "type": "string",
                  "enum": [
                    "APPROVED",
                    "PARTIALLY_PAID",
                    "PAID"
                  ]
                }
              },
              "required": [
                "billId",
                "from",
                "to"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "vendorId",
          "status",
          "remainingMinor",
          "entryId",
          "entryNumber",
          "moved"
        ],
        "additionalProperties": false
      },
      "CreateVendorResponse": {
        "type": "object",
        "properties": {
          "vendor": {
            "$ref": "#/components/schemas/ListVendorsResponseItem"
          }
        },
        "required": [
          "vendor"
        ],
        "additionalProperties": false
      },
      "CreateVendorStatementResponse": {
        "type": "object",
        "properties": {
          "statement": {
            "$ref": "#/components/schemas/Statement2"
          },
          "rows": {
            "$ref": "#/components/schemas/Rows2"
          }
        },
        "required": [
          "statement"
        ],
        "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
      },
      "Cron": {
        "type": "string",
        "pattern": "^(0|15|30|45) (\\*|\\*\\/(2|3|4|6|8|12)|(([01]?[0-9]|2[0-3])(-([01]?[0-9]|2[0-3]))?)(,([01]?[0-9]|2[0-3])(-([01]?[0-9]|2[0-3]))?)*) \\* \\* (\\*|([0-6](-[0-6])?)(,[0-6](-[0-6])?)*)$"
      },
      "Current": {
        "type": "object",
        "properties": {
          "senderPolicy": {
            "type": "string",
            "enum": [
              "ACCEPT_ALL",
              "QUARANTINE_UNAUTHENTICATED",
              "KNOWN_SENDERS_ONLY"
            ]
          },
          "addressDailyMessages": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "senderDailyMessages": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "senderPolicy",
          "addressDailyMessages",
          "senderDailyMessages"
        ],
        "additionalProperties": false
      },
      "Current2": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "ledgerId": {
                "type": "string"
              },
              "generation": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "copiedAsOf": {
                "type": "string",
                "minLength": 20
              },
              "rowCount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "ledgerId",
              "generation",
              "copiedAsOf",
              "rowCount"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "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
              }
            }
          ]
        }
      },
      "CustomFields2": {
        "description": "The record's own fields, by the field's key, archived fields' values included.",
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "boolean"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          ]
        },
        "x-stability-level": "beta"
      },
      "CustomFields3": {
        "description": "The record's own fields: a value for each custom field this ledger defines for the record's kind, by the field's key. Text, a number or a date as text, true or false, or a list of choices.",
        "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
              }
            }
          ]
        },
        "x-stability-level": "beta"
      },
      "CustomFields4": {
        "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.",
        "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"
            }
          ]
        },
        "x-stability-level": "beta"
      },
      "CustomFields5": {
        "description": "The line's own fields: a value for each line field this ledger defines for the line's kind, by the field's key. Text or true or false.",
        "type": "object",
        "propertyNames": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_]{0,39}$"
        },
        "additionalProperties": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 500
            },
            {
              "type": "boolean"
            }
          ]
        },
        "x-stability-level": "beta"
      },
      "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"
          }
        ]
      },
      "CutoversItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "financialAccountId": {
            "type": "string"
          },
          "financialAccountName": {
            "type": "string"
          },
          "glAccountCode": {
            "type": "string"
          },
          "fromConnectionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "fromConnectionName": {
            "type": [
              "string",
              "null"
            ]
          },
          "toConnectionId": {
            "type": "string"
          },
          "toConnectionName": {
            "type": "string"
          },
          "externalId": {
            "type": "string"
          },
          "coveredTo": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "stagedBefore": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "switchedAt": {
            "type": "string"
          },
          "switchedByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "matchedCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "notInStatementsCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "financialAccountId",
          "financialAccountName",
          "glAccountCode",
          "fromConnectionId",
          "fromConnectionName",
          "toConnectionId",
          "toConnectionName",
          "externalId",
          "coveredTo",
          "stagedBefore",
          "switchedAt",
          "switchedByName",
          "matchedCount",
          "notInStatementsCount"
        ],
        "additionalProperties": false
      },
      "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
        }
      },
      "Data2": {
        "type": "object",
        "properties": {
          "object": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "vendor"
              },
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "type",
              "id"
            ],
            "additionalProperties": false
          },
          "href": {
            "type": "string",
            "format": "starts_with",
            "pattern": "^\\/v1\\/.*"
          }
        },
        "required": [
          "object",
          "href"
        ],
        "additionalProperties": false
      },
      "Data3": {
        "type": "object",
        "properties": {
          "object": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "bill"
              },
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "type",
              "id"
            ],
            "additionalProperties": false
          },
          "href": {
            "type": "string",
            "format": "starts_with",
            "pattern": "^\\/v1\\/.*"
          }
        },
        "required": [
          "object",
          "href"
        ],
        "additionalProperties": false
      },
      "Data4": {
        "type": "object",
        "properties": {
          "object": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "paymentRun"
              },
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "type",
              "id"
            ],
            "additionalProperties": false
          },
          "href": {
            "type": "string",
            "format": "starts_with",
            "pattern": "^\\/v1\\/.*"
          }
        },
        "required": [
          "object",
          "href"
        ],
        "additionalProperties": false
      },
      "Data5": {
        "type": "object",
        "properties": {
          "object": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "purchaseOrder"
              },
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "type",
              "id"
            ],
            "additionalProperties": false
          },
          "href": {
            "type": "string",
            "format": "starts_with",
            "pattern": "^\\/v1\\/.*"
          }
        },
        "required": [
          "object",
          "href"
        ],
        "additionalProperties": false
      },
      "Data6": {
        "type": "object",
        "properties": {
          "object": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "vendorCredit"
              },
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "type",
              "id"
            ],
            "additionalProperties": false
          },
          "href": {
            "type": "string",
            "format": "starts_with",
            "pattern": "^\\/v1\\/.*"
          }
        },
        "required": [
          "object",
          "href"
        ],
        "additionalProperties": false
      },
      "Data7": {
        "type": "object",
        "properties": {
          "object": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "job"
              },
              "id": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "type",
              "id"
            ],
            "additionalProperties": false
          },
          "href": {
            "type": "string",
            "format": "starts_with",
            "pattern": "^\\/v1\\/.*"
          }
        },
        "required": [
          "object",
          "href"
        ],
        "additionalProperties": false
      },
      "Deadlines": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "entityId": {
              "type": "string"
            },
            "entityName": {
              "type": "string"
            },
            "kind": {
              "$ref": "#/components/schemas/Kind6"
            },
            "periodKey": {
              "type": "string",
              "pattern": "^[0-9]{4}(-Q[1-4]|-[0-9]{2}(-[0-9]{2}(-[1-4])?)?)?$"
            },
            "label": {
              "type": "string"
            },
            "authority": {
              "type": "string",
              "enum": [
                "CRA",
                "REVENU_QUEBEC",
                "ONTARIO",
                "CORPORATIONS_CANADA",
                "WSIB"
              ]
            },
            "basis": {
              "type": "string"
            },
            "statutoryDate": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "dueDate": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "status": {
              "type": "string",
              "enum": [
                "OVERDUE",
                "DUE_SOON",
                "UPCOMING",
                "DONE"
              ]
            },
            "daysUntilDue": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "asOf": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "timeZone": {
              "type": "string"
            },
            "done": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "by": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "at": {
                      "type": "string",
                      "minLength": 20
                    },
                    "note": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "evidence": {
                      "type": "string",
                      "enum": [
                        "MARK",
                        "TAX_RETURN"
                      ]
                    },
                    "taxReturnId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "by",
                    "at",
                    "note",
                    "evidence",
                    "taxReturnId"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "taxReturnId": {
              "type": [
                "string",
                "null"
              ]
            },
            "taxRegistrationId": {
              "type": [
                "string",
                "null"
              ]
            },
            "caveat": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "entityId",
            "entityName",
            "kind",
            "periodKey",
            "label",
            "authority",
            "basis",
            "statutoryDate",
            "dueDate",
            "status",
            "daysUntilDue",
            "asOf",
            "timeZone",
            "done",
            "taxReturnId",
            "taxRegistrationId",
            "caveat"
          ],
          "additionalProperties": false
        }
      },
      "Decision": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "DISMISSED",
                  "CONFIRMED"
                ]
              },
              "by": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "at": {
                "type": "string",
                "minLength": 20
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "state",
              "by",
              "at",
              "note"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Decision2": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "by": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "at": {
                "type": "string",
                "minLength": 20
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "by",
              "at",
              "note"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "DecisionFacts": {
        "anyOf": [
          {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "BILL_APPROVED"
                  },
                  "common": {
                    "$ref": "#/components/schemas/Common"
                  },
                  "invoice": {
                    "$ref": "#/components/schemas/Invoice"
                  },
                  "replaces": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Invoice"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "kind",
                  "common",
                  "invoice",
                  "replaces"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "BILL_HELD"
                  },
                  "common": {
                    "$ref": "#/components/schemas/Common"
                  },
                  "invoice": {
                    "$ref": "#/components/schemas/Invoice"
                  },
                  "need": {
                    "$ref": "#/components/schemas/Need"
                  },
                  "hold": {
                    "type": "object",
                    "properties": {
                      "heldAt": {
                        "type": "string",
                        "minLength": 20
                      },
                      "heldUntil": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "byPolicy": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "heldAt",
                      "heldUntil",
                      "byPolicy"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "kind",
                  "common",
                  "invoice",
                  "need",
                  "hold"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "BILL_DECLINED"
                  },
                  "common": {
                    "$ref": "#/components/schemas/Common"
                  },
                  "invoice": {
                    "$ref": "#/components/schemas/Invoice"
                  },
                  "why": {
                    "$ref": "#/components/schemas/Need"
                  },
                  "how": {
                    "type": "string",
                    "enum": [
                      "VOIDED",
                      "DISCARDED"
                    ]
                  },
                  "sendTo": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "kind",
                  "common",
                  "invoice",
                  "why",
                  "how",
                  "sendTo"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "CORRECTION_ASKED"
                  },
                  "common": {
                    "$ref": "#/components/schemas/Common"
                  },
                  "invoice": {
                    "$ref": "#/components/schemas/Invoice"
                  },
                  "items": {
                    "maxItems": 12,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "DOCUMENT",
                        "SUPPLIER_NAME",
                        "DATE",
                        "TOTAL",
                        "REGISTRATION",
                        "TAX_SHOWN",
                        "RECIPIENT",
                        "TERMS",
                        "DESCRIPTIONS",
                        "TAX_DIFFERS",
                        "DOES_NOT_ADD_UP"
                      ]
                    }
                  },
                  "paragraph": {
                    "$ref": "#/components/schemas/Paragraph"
                  },
                  "sendTo": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "kind",
                  "common",
                  "invoice",
                  "items",
                  "paragraph",
                  "sendTo"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "ADDRESS_CLOSING"
                  },
                  "common": {
                    "$ref": "#/components/schemas/Common"
                  },
                  "closing": {
                    "type": "object",
                    "properties": {
                      "address": {
                        "type": "string"
                      },
                      "closesOn": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "setAt": {
                        "type": "string",
                        "minLength": 20
                      },
                      "successor": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "address",
                      "closesOn",
                      "setAt",
                      "successor"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "kind",
                  "common",
                  "closing"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "BANKING_CHANGED"
                  },
                  "common": {
                    "$ref": "#/components/schemas/Common"
                  },
                  "banking": {
                    "type": "object",
                    "properties": {
                      "changeId": {
                        "type": "string"
                      },
                      "changedOn": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "recipientWasOnFileBefore": {
                        "type": "boolean",
                        "const": true
                      }
                    },
                    "required": [
                      "changeId",
                      "changedOn",
                      "recipientWasOnFileBefore"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "kind",
                  "common",
                  "banking"
                ],
                "additionalProperties": false
              }
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "DeclinePurchaseOrderSuggestionResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "hiddenUntil": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          }
        },
        "required": [
          "ok",
          "hiddenUntil"
        ],
        "additionalProperties": false
      },
      "Deductions": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "CREDIT",
                "DISCOUNT",
                "WITHHOLDING"
              ]
            },
            "amountMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "reason": {
              "type": "string"
            },
            "account": {
              "$ref": "#/components/schemas/Account"
            },
            "vendorCredit": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "number": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "number"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "kind",
            "amountMinor",
            "reason",
            "account",
            "vendorCredit"
          ],
          "additionalProperties": false
        }
      },
      "DefaultDepartment": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "active": {
                "type": "boolean"
              }
            },
            "required": [
              "id",
              "name",
              "active"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Definition": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "measures": {
                "minItems": 1,
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "groupBy": {
                "default": [],
                "maxItems": 3,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "filters": {
                "$ref": "#/components/schemas/Filters"
              },
              "period": {
                "$ref": "#/components/schemas/Period2"
              },
              "orderBy": {
                "$ref": "#/components/schemas/OrderBy"
              },
              "limit": {
                "default": 100,
                "type": "integer",
                "minimum": 1,
                "maximum": 1000
              }
            },
            "required": [
              "measures"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "sql": {
                "type": "string",
                "minLength": 1,
                "maxLength": 20000
              }
            },
            "required": [
              "sql"
            ],
            "additionalProperties": false
          }
        ]
      },
      "Definition2": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/DefinitionOption1"
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "AUTOMATION"
              },
              "trigger": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "entityId": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "currency": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "condition": {
                "$ref": "#/components/schemas/Condition2"
              },
              "actions": {
                "minItems": 1,
                "maxItems": 10,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "operation": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "params": {
                      "$ref": "#/components/schemas/Params"
                    },
                    "input": {
                      "$ref": "#/components/schemas/Params"
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    }
                  },
                  "required": [
                    "operation",
                    "params",
                    "input",
                    "label"
                  ],
                  "additionalProperties": false
                }
              },
              "maxRunsPerDay": {
                "default": 50,
                "type": "integer",
                "minimum": 1,
                "maximum": 1000
              },
              "amountCapMinor": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "kind",
              "trigger",
              "entityId",
              "currency",
              "condition",
              "actions",
              "amountCapMinor"
            ],
            "additionalProperties": false
          }
        ]
      },
      "DefinitionOption1": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "APPROVAL"
          },
          "subject": {
            "type": "string",
            "enum": [
              "BILL",
              "INVOICE",
              "PURCHASE_ORDER"
            ]
          },
          "entityId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "condition": {
            "$ref": "#/components/schemas/Condition2"
          },
          "steps": {
            "minItems": 1,
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "approver": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "PERSON"
                        },
                        "userId": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": [
                        "kind",
                        "userId"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "ROLE"
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "ADMIN",
                            "APPROVER"
                          ]
                        }
                      },
                      "required": [
                        "kind",
                        "role"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "AUTHORITY"
                        }
                      },
                      "required": [
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "GROUP"
                        },
                        "rule": {
                          "type": "string",
                          "enum": [
                            "ANY",
                            "ALL"
                          ]
                        },
                        "userIds": {
                          "minItems": 2,
                          "maxItems": 10,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1
                          }
                        }
                      },
                      "required": [
                        "kind",
                        "rule",
                        "userIds"
                      ],
                      "additionalProperties": false
                    }
                  ]
                },
                "escalation": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "afterDays": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 60
                        },
                        "to": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "PERSON"
                                },
                                "userId": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": [
                                "kind",
                                "userId"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "AUTHORITY"
                                }
                              },
                              "required": [
                                "kind"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "afterDays",
                        "to"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "approver",
                "escalation"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "kind",
          "subject",
          "entityId",
          "currency",
          "condition",
          "steps"
        ],
        "additionalProperties": false
      },
      "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
        }
      },
      "Delivery": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "via": {
                "type": "string",
                "const": "PORTAL"
              }
            },
            "required": [
              "via"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "via": {
                "type": "string",
                "const": "EMAIL"
              },
              "recipientEmail": {
                "type": "string",
                "maxLength": 320,
                "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,}$"
              }
            },
            "required": [
              "via",
              "recipientEmail"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "via": {
                "type": "string",
                "const": "BY_HAND"
              },
              "text": {
                "type": "string",
                "minLength": 4,
                "maxLength": 4000
              }
            },
            "required": [
              "via",
              "text"
            ],
            "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"
          }
        ]
      },
      "DepositsAccount": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "accountId": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "accountId",
              "code",
              "name"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Desk": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/DeskOption1"
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "ROLE"
              },
              "role": {
                "type": "string",
                "enum": [
                  "ADMIN",
                  "APPROVER"
                ]
              }
            },
            "required": [
              "kind",
              "role"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "AUTHORITY"
              }
            },
            "required": [
              "kind"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "GROUP"
              },
              "rule": {
                "type": "string",
                "enum": [
                  "ANY",
                  "ALL"
                ]
              },
              "members": {
                "minItems": 2,
                "maxItems": 10,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "kind",
              "rule",
              "members"
            ],
            "additionalProperties": false
          }
        ]
      },
      "Desk2": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "stageId": {
                "type": "string"
              },
              "position": {
                "type": "integer",
                "minimum": 1,
                "maximum": 6
              },
              "stageCount": {
                "type": "integer",
                "minimum": 1,
                "maximum": 6
              },
              "kind": {
                "type": "string",
                "enum": [
                  "REVIEW",
                  "SIGN"
                ]
              },
              "desk": {
                "$ref": "#/components/schemas/Desk"
              },
              "routedAt": {
                "type": "string",
                "minLength": 20
              },
              "forSomeoneElse": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "stageId",
              "position",
              "stageCount",
              "kind",
              "desk",
              "routedAt",
              "forSomeoneElse"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "DeskOption1": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "const": "PERSON"
          },
          "person": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "kind",
          "person"
        ],
        "additionalProperties": false
      },
      "Determination": {
        "type": "object",
        "properties": {
          "treatment": {
            "type": "string",
            "enum": [
              "STANDARD",
              "ZERO_RATED",
              "EXEMPT",
              "OUT_OF_SCOPE",
              "RELIEVED"
            ]
          },
          "taxPointDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "taxPointBasis": {
            "type": "string",
            "enum": [
              "INVOICE",
              "INVOICE_UNDELAYED",
              "AGREEMENT",
              "PAYMENT",
              "ENTRY_DATE",
              "HOLDBACK_RELEASE"
            ]
          },
          "placeOfSupply": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(CA|US)-[A-Z]{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "supplyCategory": {
            "type": "string",
            "enum": [
              "GOODS",
              "SERVICES",
              "INTANGIBLE_PROPERTY",
              "REAL_PROPERTY"
            ]
          },
          "rule": {
            "type": "string"
          },
          "trail": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "components": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "taxType": {
                  "type": "string",
                  "enum": [
                    "GST_HST",
                    "QST",
                    "PST_BC",
                    "PST_SK",
                    "PST_MB",
                    "US_SALES_TAX"
                  ]
                },
                "region": {
                  "type": "string"
                },
                "rateE5": {
                  "type": "string",
                  "pattern": "^\\d+$"
                },
                "rateEffectiveDate": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "taxAmountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "recoverable": {
                  "type": "boolean"
                },
                "itcRecoverablePct": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[01]\\.\\d{4}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "registrationMatched": {
                  "anyOf": [
                    {
                      "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"
                            }
                          ]
                        }
                      },
                      "required": [
                        "taxType",
                        "region"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "codeName": {
                  "type": "string"
                }
              },
              "required": [
                "taxType",
                "region",
                "rateE5",
                "rateEffectiveDate",
                "taxAmountMinor",
                "recoverable",
                "itcRecoverablePct",
                "registrationMatched",
                "codeName"
              ],
              "additionalProperties": false
            }
          },
          "unresolved": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "treatment",
          "taxPointDate",
          "taxPointBasis",
          "placeOfSupply",
          "supplyCategory",
          "rule",
          "trail",
          "components",
          "unresolved"
        ],
        "additionalProperties": false
      },
      "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
      },
      "Differences": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/DifferencesItem"
        }
      },
      "Differences2": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "netMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "taxMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "totalMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              }
            },
            "required": [
              "netMinor",
              "taxMinor",
              "totalMinor"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "DifferencesByClass": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "class": {
              "type": "string",
              "enum": [
                "TIMING",
                "CLASSIFICATION",
                "TAX_TREATMENT",
                "MISSING_SOURCE",
                "OUR_DEFECT",
                "THEIR_DEFECT",
                "UNEXPLAINED"
              ]
            },
            "count": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "class",
            "count"
          ],
          "additionalProperties": false
        }
      },
      "DifferencesItem": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "enum": [
              "TOTAL",
              "BILL_DATE",
              "CURRENCY"
            ]
          },
          "was": {
            "type": "string"
          },
          "now": {
            "type": "string"
          }
        },
        "required": [
          "field",
          "was",
          "now"
        ],
        "additionalProperties": false
      },
      "Dimensions": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "typeId": {
              "type": "string"
            },
            "typeLabel": {
              "type": "string"
            },
            "valueId": {
              "type": "string"
            },
            "valueCode": {
              "type": "string"
            },
            "valueName": {
              "type": "string"
            }
          },
          "required": [
            "typeId",
            "typeLabel",
            "valueId",
            "valueCode",
            "valueName"
          ],
          "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
      },
      "Dkim": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "TXT",
              "CNAME"
            ]
          },
          "host": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "matches": {
            "type": "boolean"
          }
        },
        "required": [
          "kind",
          "host",
          "label",
          "value",
          "matches"
        ],
        "additionalProperties": false
      },
      "Document": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "fileName": {
                "type": "string"
              },
              "mimeType": {
                "type": "string"
              },
              "sizeBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "id",
              "fileName",
              "mimeType",
              "sizeBytes"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "DocumentLabels": {
        "type": "object",
        "properties": {
          "en": {
            "$ref": "#/components/schemas/En"
          },
          "fr": {
            "$ref": "#/components/schemas/En"
          }
        },
        "required": [
          "en",
          "fr"
        ],
        "additionalProperties": false
      },
      "Domain": {
        "default": null,
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "status"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "DraftBankingNoticeResponse": {
        "type": "object",
        "properties": {
          "notice": {
            "$ref": "#/components/schemas/GetVendorNoticeResponse"
          }
        },
        "required": [
          "notice"
        ],
        "additionalProperties": false
      },
      "DraftRunPolicyResponsePart1": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DraftRunPolicyResponsePart1"
            }
          },
          {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/DraftRunPolicyResponsePart1"
            }
          }
        ]
      },
      "DraftVendorDuplicateBriefResponse": {
        "type": "object",
        "properties": {
          "read": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "notes": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "vendorId": {
                          "type": "string"
                        },
                        "why": {
                          "type": "string",
                          "maxLength": 500
                        }
                      },
                      "required": [
                        "vendorId",
                        "why"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "promptVersion": {
                    "type": "string"
                  }
                },
                "required": [
                  "notes",
                  "promptVersion"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "why": {
            "type": "string",
            "enum": [
              "DISCLOSURE",
              "BUDGET",
              "PROVIDER",
              "UNPARSABLE",
              "REFUSED",
              "FIGURE_INVENTED",
              "UNKNOWN_REF",
              "STOPPED_AFTER_THREE_DISMISSALS"
            ]
          }
        },
        "required": [
          "read"
        ],
        "additionalProperties": false
      },
      "DraftVendorHoldReasonResponse": {
        "type": "object",
        "properties": {
          "drafted": {
            "type": [
              "string",
              "null"
            ]
          },
          "why": {
            "type": "string",
            "enum": [
              "DISCLOSURE",
              "BUDGET",
              "PROVIDER",
              "UNPARSABLE",
              "REFUSED",
              "FIGURE_INVENTED",
              "STOPPED_AFTER_THREE_REWRITES"
            ]
          }
        },
        "required": [
          "drafted"
        ],
        "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"
          }
        ]
      },
      "Elimination": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "COMPUTED",
                  "BY_HAND"
                ]
              },
              "asAt": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "stale": {
                "type": "boolean"
              },
              "voided": {
                "type": "boolean"
              },
              "postedBy": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "postedAt": {
                "type": "string",
                "minLength": 20
              }
            },
            "required": [
              "id",
              "kind",
              "asAt",
              "stale",
              "voided",
              "postedBy",
              "postedAt"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "EliminationsItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "COMPUTED",
              "BY_HAND"
            ]
          },
          "asAt": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "stale": {
            "type": "boolean"
          },
          "eliminatedBalanceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "eliminatedNetMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "position": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "entity": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "identityHue": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "identityHue"
                  ],
                  "additionalProperties": false
                },
                "account": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "code",
                    "name"
                  ],
                  "additionalProperties": false
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                }
              },
              "required": [
                "position",
                "entity",
                "account",
                "amountMinor"
              ],
              "additionalProperties": false
            }
          },
          "postedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "postedAt": {
            "type": "string",
            "minLength": 20
          },
          "voidedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "voidedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "voidReason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "kind",
          "asAt",
          "currency",
          "stale",
          "eliminatedBalanceMinor",
          "eliminatedNetMinor",
          "note",
          "lines",
          "postedBy",
          "postedAt",
          "voidedBy",
          "voidedAt",
          "voidReason"
        ],
        "additionalProperties": false
      },
      "Email": {
        "anyOf": [
          {
            "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,}$"
          },
          {
            "type": "null"
          }
        ]
      },
      "Email2": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "ready": {
                "type": "boolean",
                "const": true
              },
              "to": {
                "type": "string"
              },
              "consentGivenOn": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "basis": {
                "type": "string",
                "enum": [
                  "WRITTEN",
                  "ELECTRONIC"
                ]
              }
            },
            "required": [
              "ready",
              "to",
              "consentGivenOn",
              "basis"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "ready": {
                "type": "boolean",
                "const": false
              },
              "why": {
                "type": "string",
                "enum": [
                  "NO_CONTACT_EMAIL",
                  "NO_CONSENT",
                  "CONSENT_WITHDRAWN",
                  "ADDRESS_CHANGED",
                  "NO_SUPPLIER_CONTACT",
                  "OUTBOUND_NOT_APPROVED",
                  "ALREADY_DELIVERED"
                ]
              },
              "sentence": {
                "type": "string"
              }
            },
            "required": [
              "ready",
              "why",
              "sentence"
            ],
            "additionalProperties": false
          }
        ]
      },
      "En": {
        "type": "object",
        "propertyNames": {
          "$ref": "#/components/schemas/EnValue"
        },
        "additionalProperties": {
          "type": "string",
          "maxLength": 200
        }
      },
      "EnValue": {
        "type": "string",
        "enum": [
          "invoiceTitle",
          "creditMemoTitle",
          "statementTitle",
          "draftMark",
          "voidMark",
          "draftNoNumber",
          "billTo",
          "documentNumber",
          "issueDate",
          "dueDate",
          "paymentTerms",
          "currency",
          "memo",
          "reference",
          "colDescription",
          "colSupply",
          "colQuantity",
          "colUnitPrice",
          "colNet",
          "colTax",
          "unitPriceNotStated",
          "noLines",
          "supplyStandard",
          "supplyZeroRated",
          "supplyExempt",
          "supplyOutOfScope",
          "subtotal",
          "taxTotal",
          "total",
          "amountApplied",
          "amountDue",
          "taxSummaryHeading",
          "taxSummaryBase",
          "taxSummaryAmount",
          "taxUnnamed",
          "registrationHeading",
          "gstHstNumber",
          "qstNumber",
          "pstNumber",
          "customerNumbersHeading",
          "termsHeading",
          "termsNetDays",
          "termsDueOnReceipt",
          "termsEarlyPayment",
          "termsInterest",
          "paymentHeading",
          "paymentNotSet",
          "paymentPayOnline",
          "pageOf",
          "creditMemoStatement",
          "creditMemoAdjusts",
          "creditMemoAdjustment",
          "statementPeriod",
          "statementOpeningBalance",
          "statementClosingBalance",
          "statementColDate",
          "statementColDocument",
          "statementColCharge",
          "statementColCredit",
          "statementColBalance"
        ]
      },
      "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
      },
      "EngineOption1": {
        "type": "object",
        "properties": {
          "treatment": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "STANDARD",
                  "ZERO_RATED",
                  "EXEMPT",
                  "OUT_OF_SCOPE",
                  "RELIEVED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "codeName": {
            "type": [
              "string",
              "null"
            ]
          },
          "taxAmountMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "treatment",
          "codeName",
          "taxAmountMinor"
        ],
        "additionalProperties": false
      },
      "Entries": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "entryId": {
              "type": "string"
            },
            "entryNumber": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "entryId",
            "entryNumber"
          ],
          "additionalProperties": false
        }
      },
      "Entry": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "number": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "number"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Entry2": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "entryNumber": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "entryNumber"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Event": {
        "type": "string",
        "enum": [
          "LOGIN",
          "LOGOUT",
          "LEDGER_SWITCH",
          "REPORT_VIEW",
          "STATEMENT_VIEW",
          "EVIDENCE_DOWNLOAD",
          "EXPORT_DOWNLOAD",
          "ADMIN_ACTION",
          "BANKING_VIEW",
          "OPERATION_READ",
          "DOCUMENT_SEARCH",
          "ANALYSIS_QUERY"
        ]
      },
      "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
      },
      "Extraction": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "supplierName": {
                "type": "string"
              },
              "invoiceNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "invoiceDate": {
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "totalMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "duplicateVerdict": {
                "type": "string",
                "enum": [
                  "CLEAR",
                  "FLAG",
                  "HARD_STOP"
                ]
              },
              "proposalId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "vendorId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "vendorName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "billId": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "supplierName",
              "invoiceNumber",
              "invoiceDate",
              "currency",
              "totalMinor",
              "duplicateVerdict",
              "proposalId",
              "vendorId",
              "vendorName",
              "billId"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Facts": {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "AMOUNT_ABOVE_RECENT",
            "FIRST_FROM_SUPPLIER",
            "SUPPLIER_NOT_ON_LIST",
            "SENDER_OR_BANKING_CHECK_OPEN",
            "ACCOUNT_NEW_FOR_SUPPLIER",
            "TAX_DIFFERS_FROM_PAPER",
            "LOOKS_LIKE_A_DUPLICATE"
          ]
        }
      },
      "FeedCandidate": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "sourceTransactionId": {
                "type": "string"
              },
              "account": {
                "$ref": "#/components/schemas/Account2"
              },
              "txnDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "description": {
                "type": "string"
              },
              "amountMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "scoreBp": {
                "type": "integer",
                "minimum": 0,
                "maximum": 10000
              },
              "linesMatching": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "billsMatching": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "sourceTransactionId",
              "account",
              "txnDate",
              "description",
              "amountMinor",
              "currency",
              "scoreBp",
              "linesMatching",
              "billsMatching"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Field": {
        "type": "string",
        "enum": [
          "ORIGINATOR_ID",
          "FILE_CREATION_NUMBER",
          "CREATION_DATE",
          "FUNDS_DATE",
          "DESTINATION_DATA_CENTRE",
          "CURRENCY",
          "RECORD_LAYOUT",
          "TOTALS",
          "LINE_ENDING",
          "TEST_MARKER",
          "ORIGINATOR_NAMES",
          "ACCOUNT_ROUTING",
          "OTHER"
        ]
      },
      "FiguresItem": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "minor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3
          }
        },
        "required": [
          "label",
          "minor",
          "currency"
        ],
        "additionalProperties": false
      },
      "FiledUnder": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "policyId": {
                "type": "string"
              },
              "authorName": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "minLength": 20
              },
              "expiresAt": {
                "type": "string",
                "minLength": 20
              },
              "dailyCap": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "policyId",
              "authorName",
              "startedAt",
              "expiresAt",
              "dailyCap"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "FillStatsOption1": {
        "type": "object",
        "properties": {
          "filledFields": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "bills": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "kept": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "changed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "declined": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "lastFiredAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "filledFields",
          "bills",
          "kept",
          "changed",
          "declined",
          "lastFiredAt"
        ],
        "additionalProperties": false
      },
      "FilteredTotalsOption1": {
        "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+$"
          },
          "held": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "total": {
            "type": "string",
            "pattern": "^-?\\d+$"
          }
        },
        "required": [
          "current",
          "d1to30",
          "d31to60",
          "d61to90",
          "over90",
          "held",
          "total"
        ],
        "additionalProperties": false
      },
      "Filters": {
        "default": [],
        "maxItems": 10,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "dimension": {
              "type": "string",
              "minLength": 1
            },
            "op": {
              "type": "string",
              "enum": [
                "eq",
                "neq",
                "in",
                "gte",
                "lte",
                "between",
                "isNull",
                "notNull"
              ]
            },
            "value": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "maxItems": 100,
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "required": [
            "dimension",
            "op"
          ],
          "additionalProperties": false
        }
      },
      "Findings": {
        "type": "array",
        "items": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "SLIPPED"
                },
                "daysAgo": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "kind",
                "daysAgo"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "AFTER_DISCOUNT"
                },
                "discountOn": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "lostMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                }
              },
              "required": [
                "kind",
                "discountOn",
                "lostMinor"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "AFTER_DUE"
                },
                "days": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "interestPerDayMinor": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "kind",
                "days",
                "interestPerDayMinor"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "Findings2": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "severity": {
              "type": "string",
              "enum": [
                "BLOCKING",
                "WARNING",
                "NOTE"
              ]
            },
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "line": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "severity",
            "code",
            "message",
            "line"
          ],
          "additionalProperties": false
        }
      },
      "FindingsItem": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "CROSS_FOOT",
              "TAX_NOT_AS_PRINTED",
              "PAYABLE_NOT_TOTAL",
              "VENDOR_DEFAULT_APPLIED",
              "VENDOR_DEFAULT_UNUSABLE",
              "CODING_RULE_UNUSABLE",
              "ACCOUNT_SHORTLIST_TRUNCATED",
              "DOCUMENT_TRUNCATED",
              "VENDOR_FROM_ADDRESS",
              "ADDRESS_VENDOR_DIFFERS",
              "DOCUMENTARY_TIER",
              "DOCUMENTARY_UNTESTED",
              "REGISTRATION_MISSING",
              "NO_SOURCE_DOCUMENT",
              "CLAIM_WINDOW",
              "REGISTRATION_UNCONFIRMED",
              "CURRENCY_NOT_VENDORS",
              "WITHHOLDING_RESIDENCY_UNSTATED",
              "OVER_BUDGET",
              "PO_REQUIRED",
              "PO_LINE_NOT_ON_ORDER",
              "PO_PRICE_VARIANCE",
              "PO_QUANTITY_VARIANCE",
              "PO_OVER_BILLED",
              "PO_NOT_RECEIVED",
              "PO_NOT_COMPARED",
              "HOLDBACK_UNSTATED",
              "LINE_PROFILE_APPLIED",
              "LINE_PROFILE_NOT_APPLIED",
              "PAID_BY_CARD_STATED"
            ]
          },
          "text": {
            "type": "string",
            "minLength": 1
          },
          "blocking": {
            "type": "boolean"
          },
          "figures": {
            "default": [],
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FiguresItem"
            }
          }
        },
        "required": [
          "kind",
          "text",
          "blocking",
          "figures"
        ],
        "additionalProperties": false
      },
      "Follows": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "reference": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "OPEN",
                  "RESOLVED",
                  "SET_ASIDE"
                ]
              }
            },
            "required": [
              "id",
              "reference",
              "status"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "FrequencyHistory": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "filingFrequency": {
              "type": "string",
              "enum": [
                "MONTHLY",
                "QUARTERLY",
                "ANNUAL"
              ]
            },
            "fiscalYearEndMonth": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            },
            "effectiveFrom": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "recordedBy": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "recordedAt": {
              "type": "string",
              "minLength": 20
            }
          },
          "required": [
            "filingFrequency",
            "fiscalYearEndMonth",
            "effectiveFrom",
            "recordedBy",
            "recordedAt"
          ],
          "additionalProperties": false
        }
      },
      "GenerateTaxReturnResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "taxRegistrationId": {
            "type": "string"
          },
          "registrationLabel": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "taxType": {
            "type": "string",
            "enum": [
              "GST_HST",
              "QST",
              "PST_BC",
              "PST_SK",
              "PST_MB",
              "US_SALES_TAX"
            ]
          },
          "periodStart": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "periodEnd": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "REVIEWED",
              "APPROVED",
              "FILED_EXTERNALLY"
            ]
          },
          "netTaxMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "generatedAt": {
            "type": "string",
            "minLength": 20
          },
          "approvedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "email": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "email"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "approvedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "filedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "email": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "email"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "filedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "confirmationNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "dueOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "line": {
                  "type": "string",
                  "enum": [
                    "101",
                    "103",
                    "104",
                    "105",
                    "106",
                    "107",
                    "108",
                    "109",
                    "110",
                    "111",
                    "112",
                    "114",
                    "115",
                    "203",
                    "204",
                    "205",
                    "206",
                    "207",
                    "208",
                    "209",
                    "210",
                    "211",
                    "212",
                    "213",
                    "405",
                    "113A",
                    "113B",
                    "113C"
                  ]
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "formAmountMinor": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "derived": {
                  "type": "boolean"
                },
                "compositionCount": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "line",
                "amountMinor",
                "formAmountMinor",
                "derived",
                "compositionCount"
              ],
              "additionalProperties": false
            }
          },
          "checks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string",
                  "enum": [
                    "LINE_101_TIES",
                    "ALL_TAXED_LINES_MATCHED",
                    "NO_UNPOSTED_IN_PERIOD",
                    "NO_LATE_POSTINGS",
                    "TREATMENT_ON_EVERY_REVENUE_LINE",
                    "INSTALMENT_SOURCE_MISSING",
                    "REBATE_FORM_REQUIRED",
                    "NO_NEGATIVE_INSTALMENT_OR_REBATE",
                    "CONTROL_ACCOUNT_MOVEMENT_EXPLAINED",
                    "UNREGISTERED_LINES_IN_PERIOD",
                    "SALES_OFF_REVENUE_ACCOUNTS",
                    "NO_NEGATIVE_FORM_LINES",
                    "QST_CONTROL_ACCOUNT_MOVEMENT_EXPLAINED",
                    "QST_REGISTRATION_IN_FORCE",
                    "ITR_NOT_DERIVABLE"
                  ]
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "BLOCKING",
                    "ADVISORY"
                  ]
                },
                "passed": {
                  "type": "boolean"
                },
                "detail": {
                  "type": "string"
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "count": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "code",
                "severity",
                "passed",
                "detail"
              ],
              "additionalProperties": false
            }
          },
          "reconciliation": {
            "type": "object",
            "properties": {
              "line101Minor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "plRevenueMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "differenceMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "byAccount": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "accountId": {
                      "type": "string"
                    },
                    "accountCode": {
                      "type": "string"
                    },
                    "accountName": {
                      "type": "string"
                    },
                    "creditMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "taggedMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "outOfScopeMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "untaggedMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    }
                  },
                  "required": [
                    "accountId",
                    "accountCode",
                    "accountName",
                    "creditMinor",
                    "taggedMinor",
                    "outOfScopeMinor",
                    "untaggedMinor"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "line101Minor",
              "plRevenueMinor",
              "differenceMinor",
              "byAccount"
            ],
            "additionalProperties": false
          },
          "latePostingTotal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "latePostings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "lineId": {
                  "type": "string"
                },
                "entryId": {
                  "type": "string"
                },
                "entryNumber": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "entryDate": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "postedAt": {
                  "type": "string",
                  "minLength": 20
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "taxAmountMinor": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "filedPeriodEnd": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                }
              },
              "required": [
                "lineId",
                "entryId",
                "entryNumber",
                "entryDate",
                "postedAt",
                "amountMinor",
                "taxAmountMinor",
                "filedPeriodEnd"
              ],
              "additionalProperties": false
            }
          },
          "generatedBy": {
            "type": "object",
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "email"
            ],
            "additionalProperties": false
          },
          "filingMethod": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "NETFILE",
                  "GIFT",
                  "MY_BUSINESS_ACCOUNT",
                  "PAPER",
                  "OTHER"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "approvable": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "taxRegistrationId",
          "registrationLabel",
          "entityId",
          "entityName",
          "taxType",
          "periodStart",
          "periodEnd",
          "status",
          "netTaxMinor",
          "generatedAt",
          "approvedBy",
          "approvedAt",
          "filedBy",
          "filedAt",
          "confirmationNumber",
          "lines",
          "checks",
          "reconciliation",
          "latePostingTotal",
          "latePostings",
          "generatedBy",
          "filingMethod",
          "approvable"
        ],
        "additionalProperties": false
      },
      "GetAiUseSummaryResponse": {
        "type": "object",
        "properties": {
          "window": {
            "type": "object",
            "properties": {
              "startUtc": {
                "type": "string",
                "minLength": 20
              },
              "endUtc": {
                "type": "string",
                "minLength": 20
              }
            },
            "required": [
              "startUtc",
              "endUtc"
            ],
            "additionalProperties": false
          },
          "ledger": {
            "type": "object",
            "properties": {
              "ceilingMicroCad": {
                "type": "string",
                "pattern": "^\\d{1,18}$"
              },
              "spentMicroCad": {
                "type": "string",
                "pattern": "^\\d{1,18}$"
              },
              "heldMicroCad": {
                "type": "string",
                "pattern": "^\\d{1,18}$"
              },
              "setBy": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "setAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "ceilingMicroCad",
              "spentMicroCad",
              "heldMicroCad",
              "setBy",
              "setAt"
            ],
            "additionalProperties": false
          },
          "groups": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "group": {
                  "type": "string",
                  "enum": [
                    "DOCUMENT_READING",
                    "CODING_AND_MATCHING",
                    "DRAFTING",
                    "CHAT"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "ceilingMicroCad": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{1,18}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "setBy": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "setAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 20
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "spentMicroCad": {
                  "type": "string",
                  "pattern": "^\\d{1,18}$"
                },
                "calls": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "overLatencyCalls": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "p95LatencyMs": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "latencyBudgetMs": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "group",
                "label",
                "ceilingMicroCad",
                "setBy",
                "setAt",
                "spentMicroCad",
                "calls",
                "overLatencyCalls",
                "p95LatencyMs",
                "latencyBudgetMs"
              ],
              "additionalProperties": false
            }
          },
          "evaluationSpentMicroCad": {
            "type": "string",
            "pattern": "^\\d{1,18}$"
          },
          "answeredBy": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "providerId": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "modelLocation": {
                  "type": "string"
                },
                "calls": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "lastAt": {
                  "type": "string",
                  "minLength": 20
                },
                "named": {
                  "type": "boolean"
                }
              },
              "required": [
                "providerId",
                "model",
                "modelLocation",
                "calls",
                "lastAt",
                "named"
              ],
              "additionalProperties": false
            }
          },
          "disclosure": {
            "type": "object",
            "properties": {
              "version": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "modelLocation": {
                "type": "string"
              },
              "modelIds": {
                "anyOf": [
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "version",
              "modelLocation",
              "modelIds"
            ],
            "additionalProperties": false
          },
          "waitingToBeRead": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "noMemberLeftLast24h": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "entityTimeZone": {
            "type": "string"
          }
        },
        "required": [
          "window",
          "ledger",
          "groups",
          "evaluationSpentMicroCad",
          "answeredBy",
          "disclosure",
          "waitingToBeRead",
          "noMemberLeftLast24h",
          "entityTimeZone"
        ],
        "additionalProperties": false
      },
      "GetBillMatchResponse": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "billId": {
                "type": "string"
              },
              "billStatus": {
                "type": "string"
              },
              "read": {
                "type": "string",
                "const": "MEASURED"
              },
              "state": {
                "type": "string",
                "enum": [
                  "NO_ORDER",
                  "MATCHED",
                  "EXCEPTIONS"
                ]
              },
              "mode": {
                "type": "string",
                "enum": [
                  "TWO_WAY",
                  "THREE_WAY"
                ]
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "required": {
                "type": "object",
                "properties": {
                  "applies": {
                    "type": "boolean"
                  },
                  "aboveMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "subtotalMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "exempt": {
                    "$ref": "#/components/schemas/Retired"
                  }
                },
                "required": [
                  "applies",
                  "aboveMinor",
                  "subtotalMinor",
                  "exempt"
                ],
                "additionalProperties": false
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "description": {
                      "type": "string"
                    },
                    "quantity": {
                      "type": "string",
                      "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                    },
                    "netMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "orderLine": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "orderId": {
                              "type": "string"
                            },
                            "orderNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "position": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "description": {
                              "type": "string"
                            },
                            "quantity": {
                              "type": "string",
                              "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                            },
                            "unitPriceMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "currency": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            },
                            "orderStatus": {
                              "type": "string",
                              "enum": [
                                "DRAFT",
                                "IN_APPROVAL",
                                "APPROVED",
                                "SENT",
                                "PART_RECEIVED",
                                "RECEIVED",
                                "CLOSED",
                                "CANCELLED"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "orderId",
                            "orderNumber",
                            "position",
                            "description",
                            "quantity",
                            "unitPriceMinor",
                            "currency",
                            "orderStatus"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "billedElsewhere": {
                      "type": "string",
                      "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                    },
                    "receivedQuantity": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "expectedNetMinor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "priceVarianceMinor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "priceVarianceBp": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "standing": {
                      "type": "string",
                      "enum": [
                        "CLEAN",
                        "NOTE",
                        "EXCEPTION",
                        "UNLINKED",
                        "NOT_COMPARED"
                      ]
                    }
                  },
                  "required": [
                    "position",
                    "description",
                    "quantity",
                    "netMinor",
                    "orderLine",
                    "billedElsewhere",
                    "receivedQuantity",
                    "expectedNetMinor",
                    "priceVarianceMinor",
                    "priceVarianceBp",
                    "standing"
                  ],
                  "additionalProperties": false
                }
              },
              "orders": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "DRAFT",
                        "IN_APPROVAL",
                        "APPROVED",
                        "SENT",
                        "PART_RECEIVED",
                        "RECEIVED",
                        "CLOSED",
                        "CANCELLED"
                      ]
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "totalMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "billedNetMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "overBilledMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "requestedBy": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "number",
                    "status",
                    "currency",
                    "totalMinor",
                    "billedNetMinor",
                    "overBilledMinor",
                    "requestedBy"
                  ],
                  "additionalProperties": false
                }
              },
              "findings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": [
                        "PO_REQUIRED",
                        "PO_LINE_NOT_ON_ORDER",
                        "PO_PRICE_VARIANCE",
                        "PO_QUANTITY_VARIANCE",
                        "PO_OVER_BILLED",
                        "PO_NOT_RECEIVED",
                        "PO_NOT_COMPARED"
                      ]
                    },
                    "severity": {
                      "type": "string",
                      "enum": [
                        "WARNING",
                        "NOTE"
                      ]
                    },
                    "line": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "fact": {
                      "type": "string"
                    },
                    "remedy": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "figures": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "tolerance": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ruleId": {
                              "type": "string"
                            },
                            "ruleVersion": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            },
                            "authorName": {
                              "type": "string"
                            },
                            "sentence": {
                              "type": "string"
                            },
                            "expiresOn": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "WOULD_APPLY",
                                "APPLIED"
                              ]
                            },
                            "valueMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "bp": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "usedMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "totalCapMinor": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "currency": {
                              "type": "string",
                              "pattern": "^[A-Z]{3}$"
                            }
                          },
                          "required": [
                            "ruleId",
                            "ruleVersion",
                            "authorName",
                            "sentence",
                            "expiresOn",
                            "state",
                            "valueMinor",
                            "bp",
                            "usedMinor",
                            "totalCapMinor",
                            "currency"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "code",
                    "severity",
                    "line",
                    "fact",
                    "remedy",
                    "figures",
                    "tolerance"
                  ],
                  "additionalProperties": false
                }
              },
              "digest": {
                "type": "string",
                "pattern": "^[0-9a-f]{16}$"
              },
              "orderReference": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string"
                      },
                      "source": {
                        "type": "string",
                        "enum": [
                          "DOCUMENT",
                          "TYPED"
                        ]
                      },
                      "found": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "text",
                      "source",
                      "found"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "may": {
                "type": "object",
                "properties": {
                  "link": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "link"
                ],
                "additionalProperties": false
              },
              "entityTimeZone": {
                "type": "string"
              }
            },
            "required": [
              "billId",
              "billStatus",
              "read",
              "state",
              "mode",
              "currency",
              "required",
              "lines",
              "orders",
              "findings",
              "digest",
              "orderReference",
              "may",
              "entityTimeZone"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "billId": {
                "type": "string"
              },
              "billStatus": {
                "type": "string"
              },
              "read": {
                "type": "string",
                "const": "UNREAD"
              },
              "state": {
                "type": "string",
                "const": "UNREAD"
              },
              "why": {
                "type": "string"
              }
            },
            "required": [
              "billId",
              "billStatus",
              "read",
              "state",
              "why"
            ],
            "additionalProperties": false
          }
        ]
      },
      "GetBillWithholdingResponse": {
        "type": "object",
        "properties": {
          "summary": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "NOT_APPLICABLE",
                  "RESIDENCY_UNSTATED",
                  "UNDECIDED",
                  "NO_SERVICE_IN_CANADA",
                  "WITHHOLDS",
                  "WAIVED"
                ]
              },
              "serviceLines": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "undecidedLines": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "inCanadaLines": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "markedNetMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "rateBp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "waiver": {
                "$ref": "#/components/schemas/Waiver"
              },
              "unstatedBecause": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "MAILING_COUNTRY",
                    "BANK_ABROAD"
                  ]
                }
              },
              "frozenBy": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "STATUS",
                      "WITHHELD_ON"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "state",
              "serviceLines",
              "undecidedLines",
              "inCanadaLines",
              "markedNetMinor",
              "currency",
              "rateBp",
              "waiver",
              "unstatedBecause",
              "frozenBy"
            ],
            "additionalProperties": false
          },
          "lines": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "lineId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "position": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "description": {
                      "type": "string"
                    },
                    "netMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "supplyCategory": {
                      "type": "string",
                      "enum": [
                        "GOODS",
                        "SERVICES",
                        "INTANGIBLE_PROPERTY",
                        "REAL_PROPERTY"
                      ]
                    },
                    "needsDecision": {
                      "type": "boolean"
                    },
                    "decision": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "IN_CANADA",
                            "OUTSIDE_CANADA",
                            "NOT_A_SERVICE"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "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"
                        }
                      ]
                    },
                    "note": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "PERSON",
                            "AGENT_DRAFT",
                            "AGENT_DRAFT_EDITED"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "earlierDecisions": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "carried": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "decision": {
                              "type": "string",
                              "enum": [
                                "IN_CANADA",
                                "OUTSIDE_CANADA",
                                "NOT_A_SERVICE"
                              ]
                            },
                            "by": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "at": {
                              "type": "string",
                              "minLength": 20
                            },
                            "billId": {
                              "type": "string"
                            },
                            "billNumber": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "declinedProposal": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "decision",
                            "by",
                            "at",
                            "billId",
                            "billNumber",
                            "declinedProposal"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "lineId",
                    "position",
                    "description",
                    "netMinor",
                    "supplyCategory",
                    "needsDecision",
                    "decision",
                    "decidedBy",
                    "decidedAt",
                    "note",
                    "source",
                    "earlierDecisions",
                    "carried"
                  ],
                  "additionalProperties": false
                }
              },
              "nextCursor": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "total": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "data",
              "nextCursor",
              "total"
            ],
            "additionalProperties": false
          },
          "lastDecisionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "current": {
            "type": "boolean"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "mayDecide": {
            "type": "boolean"
          }
        },
        "required": [
          "summary",
          "lines",
          "lastDecisionId",
          "revision",
          "current",
          "entityTimeZone",
          "mayDecide"
        ],
        "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
      },
      "GetCustomerSummaryResponse": {
        "type": "object",
        "properties": {
          "subject": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "displayName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "displayName"
            ],
            "additionalProperties": false
          },
          "companies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "entityId": {
                  "type": "string",
                  "minLength": 1
                },
                "entityName": {
                  "type": "string"
                },
                "currency": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$"
                },
                "openBalanceMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "ageing": {
                  "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+$"
                    },
                    "held": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    }
                  },
                  "required": [
                    "current",
                    "d1to30",
                    "d31to60",
                    "d61to90",
                    "over90",
                    "held"
                  ],
                  "additionalProperties": false
                },
                "unappliedCreditMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "openItemCount": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "oldestDueOn": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "daysLate": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "daysToPay": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "closedCount12m": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "lastPayment": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "on": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "amountMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "ref": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "receipt",
                                "payment",
                                "settlement"
                              ]
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1
                            }
                          },
                          "required": [
                            "kind",
                            "id"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "on",
                        "amountMinor",
                        "currency",
                        "ref"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "topOpenItems": {
                  "maxItems": 5,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "invoice",
                          "bill"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "number": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "dueOn": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "currency": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      "openMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "daysLate": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "number",
                      "dueOn",
                      "currency",
                      "openMinor",
                      "daysLate"
                    ],
                    "additionalProperties": false
                  }
                },
                "asOfDay": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                }
              },
              "required": [
                "entityId",
                "entityName",
                "currency",
                "openBalanceMinor",
                "ageing",
                "unappliedCreditMinor",
                "openItemCount",
                "oldestDueOn",
                "daysLate",
                "daysToPay",
                "closedCount12m",
                "lastPayment",
                "topOpenItems",
                "asOfDay"
              ],
              "additionalProperties": false
            }
          },
          "asOf": {
            "$ref": "#/components/schemas/AsOf"
          }
        },
        "required": [
          "subject",
          "companies",
          "asOf"
        ],
        "additionalProperties": false
      },
      "GetCutoverResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "conversionDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "previousSystem": {
            "type": "string",
            "enum": [
              "QUICKBOOKS_ONLINE",
              "QUICKBOOKS_DESKTOP",
              "XERO",
              "SAGE_50",
              "SPREADSHEET",
              "OTHER"
            ]
          },
          "previousSystemLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "previousSystemName": {
            "type": "string"
          },
          "suspenseAccount": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "code",
              "name"
            ],
            "additionalProperties": false
          },
          "state": {
            "type": "string",
            "enum": [
              "OPEN",
              "SETTLED",
              "WITHDRAWN"
            ]
          },
          "openedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "openedAt": {
            "type": "string",
            "minLength": 20
          },
          "settledBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "settledAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "itcClaimedInPreviousSystem": {
            "type": "boolean"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "settledNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "goLiveDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "openingEntry": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "entryNumber": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "entryDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "status": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "entryNumber",
                  "entryDate",
                  "status"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "checks": {
            "minItems": 7,
            "maxItems": 7,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "check": {
                  "type": "string",
                  "enum": [
                    "CHART",
                    "OPENING_TRIAL_BALANCE",
                    "VENDORS",
                    "PAYABLES_TIE",
                    "SUSPENSE_NIL",
                    "BANKING",
                    "PERIODS_LOCKED"
                  ]
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "PASSED",
                    "FAILED",
                    "NOT_READ"
                  ]
                },
                "claim": {
                  "type": "string"
                },
                "detail": {
                  "type": "string"
                },
                "remedy": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "count": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "rows": {
                  "maxItems": 25,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "SUPPLIER",
                          "MONTH",
                          "ACCOUNT",
                          "ENTRY",
                          "IMPORT",
                          "LINES"
                        ]
                      },
                      "id": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "label": {
                        "type": "string"
                      },
                      "detail": {
                        "type": "string"
                      },
                      "href": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "id",
                      "label",
                      "detail",
                      "href"
                    ],
                    "additionalProperties": false
                  }
                },
                "rowsTotal": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "href": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "acknowledged": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "vendorId": {
                        "type": "string"
                      },
                      "vendorName": {
                        "type": "string"
                      },
                      "reason": {
                        "type": "string"
                      },
                      "byName": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "vendorId",
                      "vendorName",
                      "reason",
                      "byName"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "check",
                "state",
                "claim",
                "detail",
                "remedy",
                "count",
                "rows",
                "rowsTotal",
                "href",
                "acknowledged"
              ],
              "additionalProperties": false
            }
          },
          "checksDigest": {
            "type": "string",
            "pattern": "^[0-9a-f]{16}$"
          },
          "checksReadAt": {
            "type": "string",
            "minLength": 20
          },
          "figures": {
            "type": "object",
            "properties": {
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "suspenseMinor": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "subledgerMinor": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "controlMinor": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "unexplainedMinor": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "currency",
              "suspenseMinor",
              "subledgerMinor",
              "controlMinor",
              "unexplainedMinor"
            ],
            "additionalProperties": false
          },
          "checksPassing": {
            "type": "integer",
            "minimum": 0,
            "maximum": 7
          },
          "sales": {
            "type": "object",
            "properties": {
              "documentsBeforeGoLive": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "documentsBeforeGoLive"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "entityTimeZone",
          "conversionDate",
          "previousSystem",
          "previousSystemLabel",
          "previousSystemName",
          "suspenseAccount",
          "state",
          "openedBy",
          "openedAt",
          "settledBy",
          "settledAt",
          "itcClaimedInPreviousSystem",
          "note",
          "settledNote",
          "goLiveDate",
          "openingEntry",
          "checks",
          "checksDigest",
          "checksReadAt",
          "figures",
          "checksPassing",
          "sales"
        ],
        "additionalProperties": false
      },
      "GetEntryResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "ledgerId": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "entryNumber": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "entryRef": {
            "type": "string"
          },
          "entryDate": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "PROPOSED",
              "IN_REVIEW",
              "APPROVED",
              "POSTED",
              "DECLINED",
              "REVERSED"
            ]
          },
          "sourceKind": {
            "type": "string",
            "enum": [
              "MANUAL",
              "AGENT_PROPOSAL",
              "RECURRING",
              "REVERSAL",
              "IMPORT",
              "CHAT",
              "MIGRATION",
              "PAYMENT_RUN",
              "INVOICE",
              "RECEIPT",
              "BILL",
              "BILL_SETTLEMENT",
              "VENDOR_CREDIT"
            ]
          },
          "sourceLabel": {
            "type": "string"
          },
          "sourceLink": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "INVOICE",
                      "CREDIT_NOTE",
                      "RECEIPT"
                    ]
                  },
                  "id": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "href": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "kind",
                  "id",
                  "label",
                  "href"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "memo": {
            "type": [
              "string",
              "null"
            ]
          },
          "layer": {
            "type": "string",
            "enum": [
              "POSTING",
              "ELIMINATION"
            ]
          },
          "autoReverse": {
            "type": "boolean"
          },
          "reversalDate": {
            "type": [
              "string",
              "null"
            ]
          },
          "attribution": {
            "type": "string"
          },
          "createdBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "email": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "email"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "approvedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "email": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "email"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "postedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "email": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "email"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "declinedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "email": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "email"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "declineReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "postedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "reversesEntryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "reversedByEntryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "reversesEntryRef": {
            "type": [
              "string",
              "null"
            ]
          },
          "reversedByEntryRef": {
            "type": [
              "string",
              "null"
            ]
          },
          "proposal": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "agentLabel": {
                    "type": "string"
                  },
                  "reasoning": {
                    "type": "string"
                  },
                  "confidence": {
                    "type": "string"
                  },
                  "model": {
                    "type": "string"
                  },
                  "promptVersion": {
                    "type": "string"
                  },
                  "configuredByName": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "status": {
                    "type": "string"
                  },
                  "delivery": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "region": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "regionLabel": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "DOCUMENT",
                              "ENTITY",
                              "NONE"
                            ]
                          }
                        },
                        "required": [
                          "region",
                          "regionLabel",
                          "source"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "findings": {
                    "default": [],
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/FindingsItem"
                    }
                  }
                },
                "required": [
                  "id",
                  "agentLabel",
                  "reasoning",
                  "confidence",
                  "model",
                  "promptVersion",
                  "configuredByName",
                  "status",
                  "findings"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "recurringScheduleId": {
            "type": [
              "string",
              "null"
            ]
          },
          "totalDebitMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "totalCreditMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "accountId": {
                  "type": "string"
                },
                "accountCode": {
                  "type": "string"
                },
                "accountName": {
                  "type": "string"
                },
                "accountGifiCode": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "memo": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "currency": {
                  "type": "string"
                },
                "functionalCurrency": {
                  "type": "string"
                },
                "functionalAmountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "fxRate": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "fxRateSource": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "BOC",
                        "MANUAL",
                        "PROVIDER"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "fxRateDate": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "taxFxRate": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "taxFxRateSource": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "BOC",
                        "MANUAL",
                        "PROVIDER"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "taxFxRateDate": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "taxAmountMinor": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "taxLabel": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "itcEligible": {
                  "type": "boolean"
                },
                "tax": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "treatment": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "STANDARD",
                                "ZERO_RATED",
                                "EXEMPT",
                                "OUT_OF_SCOPE",
                                "RELIEVED"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "taxPointDate": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "taxPointBasis": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "INVOICE",
                                "INVOICE_UNDELAYED",
                                "AGREEMENT",
                                "PAYMENT",
                                "ENTRY_DATE",
                                "HOLDBACK_RELEASE"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "placeOfSupply": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^(CA|US)-[A-Z]{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "supplyCategory": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "GOODS",
                                "SERVICES",
                                "INTANGIBLE_PROPERTY",
                                "REAL_PROPERTY"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "rateE5": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d+$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "codeName": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "taxAmountMinor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "functionalTaxAmountMinor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "taxProvincialAmountMinor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "functionalTaxProvincialAmountMinor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "itcEligible": {
                          "type": "boolean"
                        },
                        "itcRecoverablePct": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^[01]\\.\\d{4}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "selfAssessed": {
                          "type": "boolean"
                        },
                        "registrationId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "registrationLabel": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "overridden": {
                          "type": "boolean"
                        },
                        "overrideReason": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "overriddenByName": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "treatment",
                        "taxPointDate",
                        "taxPointBasis",
                        "placeOfSupply",
                        "supplyCategory",
                        "rateE5",
                        "codeName",
                        "taxAmountMinor",
                        "functionalTaxAmountMinor",
                        "taxProvincialAmountMinor",
                        "functionalTaxProvincialAmountMinor",
                        "itcEligible",
                        "itcRecoverablePct",
                        "selfAssessed",
                        "registrationId",
                        "registrationLabel",
                        "overridden",
                        "overrideReason",
                        "overriddenByName"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "dimensions": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "typeCode": {
                        "type": "string"
                      },
                      "typeLabel": {
                        "type": "string"
                      },
                      "valueCode": {
                        "type": "string"
                      },
                      "valueLabel": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "typeCode",
                      "typeLabel",
                      "valueCode",
                      "valueLabel"
                    ],
                    "additionalProperties": false
                  }
                },
                "customFields": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": [
                      "string",
                      "boolean"
                    ]
                  }
                },
                "carriedFrom": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "accountId",
                "accountCode",
                "accountName",
                "accountGifiCode",
                "memo",
                "amountMinor",
                "currency",
                "functionalCurrency",
                "functionalAmountMinor",
                "fxRate",
                "fxRateSource",
                "fxRateDate",
                "taxFxRate",
                "taxFxRateSource",
                "taxFxRateDate",
                "taxAmountMinor",
                "taxLabel",
                "itcEligible",
                "tax",
                "dimensions"
              ],
              "additionalProperties": false
            }
          },
          "evidence": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "document",
                    "source-transaction",
                    "other"
                  ]
                },
                "addedByName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "documentFileName": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "sourceTransaction": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "txnDate": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "counterparty": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "amountMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "connectionName": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "txnDate",
                        "description",
                        "counterparty",
                        "amountMinor",
                        "currency",
                        "status",
                        "connectionName"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "label",
                "kind",
                "addedByName"
              ],
              "additionalProperties": false
            }
          },
          "history": {
            "$ref": "#/components/schemas/History"
          },
          "historyTotal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "customFields": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            }
          }
        },
        "required": [
          "id",
          "ledgerId",
          "entityId",
          "entityName",
          "entryNumber",
          "entryRef",
          "entryDate",
          "status",
          "sourceKind",
          "sourceLabel",
          "memo",
          "layer",
          "autoReverse",
          "reversalDate",
          "attribution",
          "createdBy",
          "approvedBy",
          "postedBy",
          "declinedBy",
          "declineReason",
          "postedAt",
          "reversesEntryId",
          "reversedByEntryId",
          "recurringScheduleId",
          "totalDebitMinor",
          "totalCreditMinor",
          "lines",
          "evidence",
          "history",
          "historyTotal"
        ],
        "additionalProperties": false
      },
      "GetInboundAddressResponse": {
        "type": "object",
        "properties": {
          "domain": {
            "$ref": "#/components/schemas/Domain"
          },
          "id": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "mailbox": {
            "type": "string",
            "enum": [
              "BILLS",
              "INVOICES"
            ]
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "REVOKED"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "createdByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "revokedByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "revokeReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "messageCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "lastMessageAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "vendorId": {
            "type": [
              "string",
              "null"
            ]
          },
          "vendorName": {
            "type": [
              "string",
              "null"
            ]
          },
          "vendorStatus": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "ACTIVE",
                  "ARCHIVED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "purpose": {
            "type": [
              "string",
              "null"
            ]
          },
          "watcherUserId": {
            "type": "string"
          },
          "watcherName": {
            "type": "string"
          },
          "watcherSeat": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "ADMIN",
                  "APPROVER",
                  "PREPARER"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "contact": {
            "$ref": "#/components/schemas/Contact"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "senders": {
            "$ref": "#/components/schemas/Senders"
          },
          "senderDomainCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "replies": {
            "$ref": "#/components/schemas/Replies"
          },
          "reasonSharedWithSenders": {
            "type": "boolean"
          },
          "closing": {
            "$ref": "#/components/schemas/Closing"
          },
          "heldOpen": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "watcherTelephone": {
            "type": [
              "string",
              "null"
            ]
          },
          "submittedAs": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "userId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "fellBack": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "userId",
                  "name",
                  "fellBack"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "refusalCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "bindingSuggestion": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "vendorId": {
                    "type": "string"
                  },
                  "vendorName": {
                    "type": "string"
                  },
                  "billCount": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "firstApprovedAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "lastApprovedAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "windowDays": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "bills": {
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "number": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "billDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "totalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        }
                      },
                      "required": [
                        "id",
                        "number",
                        "billDate",
                        "totalMinor",
                        "currency"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "vendorId",
                  "vendorName",
                  "billCount",
                  "firstApprovedAt",
                  "lastApprovedAt",
                  "windowDays",
                  "bills"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "declinedSuggestion": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "vendorId": {
                    "type": "string"
                  },
                  "vendorName": {
                    "type": "string"
                  },
                  "declinedAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "declinedByName": {
                    "type": "string"
                  }
                },
                "required": [
                  "vendorId",
                  "vendorName",
                  "declinedAt",
                  "declinedByName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "domain",
          "id",
          "address",
          "label",
          "mailbox",
          "entityId",
          "entityName",
          "status",
          "createdAt",
          "createdByName",
          "revokedAt",
          "revokedByName",
          "revokeReason",
          "messageCount",
          "lastMessageAt",
          "vendorId",
          "vendorName",
          "vendorStatus",
          "purpose",
          "watcherUserId",
          "watcherName",
          "watcherSeat",
          "contact",
          "entityTimeZone",
          "senders",
          "senderDomainCount",
          "replies",
          "reasonSharedWithSenders",
          "closing",
          "heldOpen",
          "watcherTelephone",
          "submittedAs",
          "refusalCount",
          "bindingSuggestion",
          "declinedSuggestion"
        ],
        "additionalProperties": false
      },
      "GetInboundEmailResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "receivedAt": {
            "type": "string",
            "minLength": 20
          },
          "entityTimeZone": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "addressId": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "addressLabel": {
            "type": "string"
          },
          "mailbox": {
            "type": "string",
            "enum": [
              "BILLS",
              "INVOICES"
            ]
          },
          "sender": {
            "type": "string"
          },
          "senderDomain": {
            "type": "string"
          },
          "subject": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "partCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "reference": {
            "type": "string"
          },
          "partNames": {
            "maxItems": 60,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "state": {
            "type": "string",
            "enum": [
              "READ",
              "IN_REVIEW",
              "BOOKED",
              "UNREADABLE",
              "NOT_A_BILL",
              "DUPLICATE",
              "HELD",
              "SLIP",
              "STATEMENT"
            ]
          },
          "stateSentence": {
            "type": "string"
          },
          "became": {
            "$ref": "#/components/schemas/Became2"
          },
          "reading": {
            "$ref": "#/components/schemas/Reading3"
          },
          "waiting": {
            "type": "boolean"
          },
          "auth": {
            "$ref": "#/components/schemas/Auth"
          },
          "forward": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "UNRECORDED",
                  "DIRECT",
                  "FORWARDED"
                ]
              },
              "basis": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "RESENT_HEADERS",
                      "AUTO_FORWARD_HEADERS",
                      "ATTACHED_MESSAGE",
                      "INLINE_BLOCK",
                      "SUBJECT_ONLY"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "forwardedBy": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "forwardedByName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "originalSender": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "state",
              "basis",
              "forwardedBy",
              "forwardedByName",
              "originalSender"
            ],
            "additionalProperties": false
          },
          "statement": {
            "$ref": "#/components/schemas/Statement"
          },
          "vendorQuery": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "reference"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "messageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "sentAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "rawDocument": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "fileName": {
                "type": "string"
              },
              "sizeBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "id",
              "fileName",
              "sizeBytes"
            ],
            "additionalProperties": false
          },
          "parts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "fileName": {
                  "type": "string"
                },
                "contentType": {
                  "type": "string"
                },
                "sizeBytes": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "BILL",
                    "RETAINED",
                    "DISCARDED"
                  ]
                },
                "reasons": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "stored": {
                  "type": "boolean"
                },
                "documentId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "notStoredSentence": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "index",
                "fileName",
                "contentType",
                "sizeBytes",
                "role",
                "reasons",
                "stored",
                "documentId",
                "notStoredSentence"
              ],
              "additionalProperties": false
            }
          },
          "selectionSummary": {
            "type": [
              "string",
              "null"
            ]
          },
          "deliverySlip": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "PROPOSED",
                      "NO_ORDER",
                      "SEVERAL_ORDERS",
                      "NOTHING_OUTSTANDING",
                      "NOT_A_SLIP",
                      "UNREADABLE",
                      "PAUSED",
                      "MODEL_FAILED"
                    ]
                  },
                  "sentence": {
                    "type": "string"
                  },
                  "orderReference": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "purchaseOrder": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "number"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "goodsReceipt": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "sequence": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "PROPOSED",
                              "CONFIRMED",
                              "VOID",
                              "DISCARDED"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "sequence",
                          "status"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "senderDomain": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "resumesOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "outcome",
                  "sentence",
                  "orderReference",
                  "purchaseOrder",
                  "goodsReceipt",
                  "senderDomain",
                  "resumesOn"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "causationName": {
            "type": "string"
          },
          "authResult": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string",
                    "const": "UNRECORDED"
                  }
                },
                "required": [
                  "source"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string",
                    "const": "NONE"
                  }
                },
                "required": [
                  "source"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string",
                    "const": "POSTMARK"
                  },
                  "spf": {
                    "type": "string",
                    "enum": [
                      "PASS",
                      "FAIL",
                      "SOFTFAIL",
                      "NEUTRAL",
                      "NONE",
                      "TEMPERROR",
                      "PERMERROR",
                      "UNKNOWN"
                    ]
                  },
                  "spfAligned": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "dkim": {
                    "type": "string",
                    "enum": [
                      "PASS",
                      "FAIL",
                      "SOFTFAIL",
                      "NEUTRAL",
                      "NONE",
                      "TEMPERROR",
                      "PERMERROR",
                      "UNKNOWN"
                    ]
                  },
                  "dkimAligned": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "dmarc": {
                    "type": "string",
                    "enum": [
                      "PASS",
                      "FAIL",
                      "SOFTFAIL",
                      "NEUTRAL",
                      "NONE",
                      "TEMPERROR",
                      "PERMERROR",
                      "UNKNOWN"
                    ]
                  },
                  "tests": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 40,
                      "pattern": "^(?:SPF|DKIM|DMARC)_[A-Z0-9_]+$"
                    }
                  }
                },
                "required": [
                  "source",
                  "spf",
                  "spfAligned",
                  "dkim",
                  "dkimAligned",
                  "dmarc",
                  "tests"
                ],
                "additionalProperties": false
              }
            ]
          },
          "notABill": {
            "$ref": "#/components/schemas/NotABill"
          },
          "handled": {
            "$ref": "#/components/schemas/NotABill"
          },
          "sentToReader": {
            "$ref": "#/components/schemas/NotABill"
          },
          "hold": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "enum": [
                      "UNAUTHENTICATED",
                      "UNKNOWN_SENDER",
                      "SENDER_DAY_MESSAGES",
                      "ADDRESS_DAY_MESSAGES",
                      "SENDER_DAY_SPEND",
                      "ADDRESS_DAY_SPEND"
                    ]
                  },
                  "stage": {
                    "type": "string",
                    "enum": [
                      "INTAKE",
                      "READER"
                    ]
                  },
                  "reasonSentence": {
                    "type": "string"
                  },
                  "limit": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "measured": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "setBy": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "setAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 20
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "policy": {
                    "type": "string",
                    "enum": [
                      "ACCEPT_ALL",
                      "QUARANTINE_UNAUTHENTICATED",
                      "KNOWN_SENDERS_ONLY"
                    ]
                  },
                  "heldAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "notified": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "names": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "at": {
                            "type": "string",
                            "minLength": 20
                          }
                        },
                        "required": [
                          "names",
                          "at"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "reason",
                  "stage",
                  "reasonSentence",
                  "limit",
                  "measured",
                  "setBy",
                  "setAt",
                  "policy",
                  "heldAt",
                  "notified"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "receivedAt",
          "entityTimeZone",
          "entityId",
          "entityName",
          "addressId",
          "address",
          "addressLabel",
          "mailbox",
          "sender",
          "senderDomain",
          "subject",
          "partCount",
          "reference",
          "partNames",
          "state",
          "stateSentence",
          "became",
          "reading",
          "waiting",
          "auth",
          "forward",
          "statement",
          "vendorQuery",
          "messageId",
          "sentAt",
          "rawDocument",
          "parts",
          "selectionSummary",
          "deliverySlip",
          "causationName",
          "authResult",
          "notABill",
          "handled",
          "sentToReader",
          "hold"
        ],
        "additionalProperties": false
      },
      "GetIntercompanyPairResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "from": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "identityHue": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "identityHue"
            ],
            "additionalProperties": false
          },
          "to": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "identityHue": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "identityHue"
            ],
            "additionalProperties": false
          },
          "bill": {
            "$ref": "#/components/schemas/Bill"
          },
          "decision": {
            "type": "string",
            "enum": [
              "PROPOSED",
              "MIRRORED",
              "DECLINED"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "NO_MIRROR",
              "MIRROR_DRAFT",
              "MATCHED",
              "DIFFERS",
              "MIRROR_VOID",
              "BILL_VOID",
              "DECLINED"
            ]
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "CURRENCY",
                "NET",
                "TAX",
                "WRONG_CUSTOMER",
                "MIRROR_WRITTEN_OFF"
              ]
            }
          },
          "differences": {
            "$ref": "#/components/schemas/Differences2"
          },
          "mirror": {
            "$ref": "#/components/schemas/Mirror"
          },
          "mirrorHidden": {
            "type": "boolean"
          },
          "mirrorHow": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "CREATED",
                  "LINKED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "elimination": {
            "$ref": "#/components/schemas/Elimination"
          },
          "proposedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "proposedAt": {
            "type": "string",
            "minLength": 20
          },
          "entityTimeZone": {
            "type": "string"
          },
          "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"
              }
            ]
          },
          "declineReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "standingCustomer": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "displayName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "bestCandidate": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BestCandidateOption1"
              },
              {
                "type": "null"
              }
            ]
          },
          "eliminations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EliminationsItem"
            }
          },
          "reading": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "OFF",
                  "NOT_NEEDED",
                  "WAITING",
                  "READ",
                  "STOPPED",
                  "FAILED"
                ]
              },
              "outcome": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "READ",
                      "NOTHING_STATED",
                      "UNSANE",
                      "UNPARSABLE",
                      "REFUSED",
                      "DISCLOSURE",
                      "BUDGET",
                      "PROVIDER",
                      "STOPPED_AFTER_DECLINES"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "attempts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 3
              },
              "promptVersion": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "readAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "state",
              "outcome",
              "attempts",
              "promptVersion",
              "readAt"
            ],
            "additionalProperties": false
          },
          "proposedRevision": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "billRevision": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "from",
          "to",
          "bill",
          "decision",
          "state",
          "reasons",
          "differences",
          "mirror",
          "mirrorHidden",
          "mirrorHow",
          "elimination",
          "proposedBy",
          "proposedAt",
          "entityTimeZone",
          "decidedBy",
          "decidedAt",
          "declineReason",
          "standingCustomer",
          "bestCandidate",
          "eliminations",
          "reading",
          "proposedRevision",
          "billRevision"
        ],
        "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
      },
      "GetInvoiceTemplateResponse": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string"
          },
          "saved": {
            "type": "boolean"
          },
          "logo": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "contentType": {
                    "type": "string",
                    "enum": [
                      "image/png",
                      "image/svg+xml"
                    ]
                  },
                  "byteSize": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "uploadedAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "uploadedBy": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "contentType",
                  "byteSize",
                  "sha256",
                  "uploadedAt",
                  "uploadedBy"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "showItemCode": {
            "type": "boolean"
          },
          "showServicePeriod": {
            "type": "boolean"
          },
          "showDiscount": {
            "type": "boolean"
          },
          "showOriginAndHsCode": {
            "type": "boolean"
          },
          "showCustomFields": {
            "type": "boolean"
          },
          "footerNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "termsText": {
            "type": [
              "string",
              "null"
            ]
          },
          "updatedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "updatedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "entityId",
          "saved",
          "logo",
          "showItemCode",
          "showServicePeriod",
          "showDiscount",
          "showOriginAndHsCode",
          "showCustomFields",
          "footerNote",
          "termsText",
          "updatedAt",
          "updatedBy"
        ],
        "additionalProperties": false
      },
      "GetParallelRunMonthResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "periodYear": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodMonth": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodLabel": {
            "type": "string"
          },
          "periodEnd": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "CLEAN",
              "NOT_CLEAN"
            ]
          },
          "partnerSystem": {
            "type": "string"
          },
          "partnerClosedOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "partnerCloseDays": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "ourCloseDays": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "recordedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "recordedAt": {
            "type": "string",
            "minLength": 20
          },
          "signedOffBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "signedOffAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "differencesByClass": {
            "$ref": "#/components/schemas/DifferencesByClass"
          },
          "unclassifiedDifferences": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "timeZone": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "statementPeriodStart": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "statementPeriodNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "comparisons": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "comparison": {
                  "type": "string",
                  "enum": [
                    "CLOSE_TIME",
                    "TRIAL_BALANCE",
                    "STATEMENT",
                    "RETURN",
                    "PAYABLES"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "absent": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "total": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "differenceCount": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "unclassifiedCount": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "lines": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "comparison": {
                        "type": "string",
                        "enum": [
                          "CLOSE_TIME",
                          "TRIAL_BALANCE",
                          "STATEMENT",
                          "RETURN",
                          "PAYABLES"
                        ]
                      },
                      "key": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      },
                      "theirsMinor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "oursMinor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "currency": {
                        "type": "string"
                      },
                      "differenceMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "class": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "TIMING",
                              "CLASSIFICATION",
                              "TAX_TREATMENT",
                              "MISSING_SOURCE",
                              "OUR_DEFECT",
                              "THEIR_DEFECT",
                              "UNEXPLAINED"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "explanation": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "classifiedBy": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "classifiedAt": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 20
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "vendorId": {
                        "default": null,
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "theirLabel": {
                        "default": null,
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "ourEvidence": {
                        "default": null,
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "billsMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "creditMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "heldMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "billCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "heldBillCount": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "oldestDueDate": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "bills": {
                                "anyOf": [
                                  {
                                    "maxItems": 25,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "billId": {
                                          "type": "string"
                                        },
                                        "number": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "billDate": {
                                          "type": "string",
                                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                        },
                                        "postingDate": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "dueDate": {
                                          "type": "string",
                                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                        },
                                        "openMinor": {
                                          "type": "string",
                                          "pattern": "^-?\\d+$"
                                        },
                                        "held": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": [
                                        "billId",
                                        "number",
                                        "billDate",
                                        "postingDate",
                                        "dueDate",
                                        "openMinor",
                                        "held"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "billsTruncated": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "billsMinor",
                              "creditMinor",
                              "heldMinor",
                              "billCount",
                              "heldBillCount",
                              "oldestDueDate",
                              "bills",
                              "billsTruncated"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "proposal": {
                        "default": null,
                        "anyOf": [
                          {
                            "$ref": "#/components/schemas/ProposalOption1"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "comparison",
                      "key",
                      "label",
                      "theirsMinor",
                      "oursMinor",
                      "currency",
                      "differenceMinor",
                      "class",
                      "explanation",
                      "classifiedBy",
                      "classifiedAt",
                      "vendorId",
                      "theirLabel",
                      "ourEvidence",
                      "proposal"
                    ],
                    "additionalProperties": false
                  }
                },
                "nextCursor": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "comparison",
                "label",
                "description",
                "absent",
                "total",
                "differenceCount",
                "unclassifiedCount",
                "lines",
                "nextCursor"
              ],
              "additionalProperties": false
            }
          },
          "conditions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "condition": {
                  "type": "string",
                  "enum": [
                    "BOTH_CLOSED",
                    "EVERY_DIFFERENCE_CLASSED",
                    "UNEXPLAINED_IS_ZERO",
                    "NO_OPEN_OUR_DEFECT",
                    "RETURN_RECONCILES",
                    "EVERY_PROPOSAL_NAMED",
                    "COMPARISON_RECORDED"
                  ]
                },
                "passed": {
                  "type": "boolean"
                },
                "claim": {
                  "type": "string"
                },
                "detail": {
                  "type": "string"
                }
              },
              "required": [
                "condition",
                "passed",
                "claim",
                "detail"
              ],
              "additionalProperties": false
            }
          },
          "signOffReasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "consecutiveClean": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "queueMetrics": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Queue"
              },
              {
                "type": "null"
              }
            ]
          },
          "payables": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "LEGACY",
                  "COMPARED",
                  "MONTH_NOT_ENDED",
                  "OVER_CEILING"
                ]
              },
              "computedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "computedBy": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "tie": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/TieOption1"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "footing": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "theirSupplierLinesMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "theirTotalMinor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "oursSupplierLinesMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "footed": {
                        "type": [
                          "boolean",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "theirSupplierLinesMinor",
                      "theirTotalMinor",
                      "oursSupplierLinesMinor",
                      "footed"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "proposals": {
                "type": "object",
                "properties": {
                  "waiting": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "outOfDate": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "setByHand": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "accepted": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "edited": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "declined": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "waiting",
                  "outOfDate",
                  "setByHand",
                  "accepted",
                  "edited",
                  "declined"
                ],
                "additionalProperties": false
              },
              "assistant": {
                "type": "object",
                "properties": {
                  "modelStopped": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "modelStopped"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "state",
              "computedAt",
              "computedBy",
              "tie",
              "footing",
              "proposals",
              "assistant"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "periodYear",
          "periodMonth",
          "periodLabel",
          "periodEnd",
          "status",
          "partnerSystem",
          "partnerClosedOn",
          "partnerCloseDays",
          "ourCloseDays",
          "recordedBy",
          "recordedAt",
          "signedOffBy",
          "signedOffAt",
          "differencesByClass",
          "unclassifiedDifferences",
          "note",
          "timeZone",
          "currency",
          "statementPeriodStart",
          "statementPeriodNote",
          "comparisons",
          "conditions",
          "signOffReasons",
          "consecutiveClean",
          "queueMetrics",
          "payables"
        ],
        "additionalProperties": false
      },
      "GetPromotionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "testCopyId": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "PROPOSED",
              "APPLIED",
              "CONFLICTED",
              "APPLYING"
            ]
          },
          "changes": {
            "$ref": "#/components/schemas/Changes"
          },
          "conflicts": {
            "$ref": "#/components/schemas/Conflicts"
          },
          "proposalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "outcome": {
            "type": [
              "string",
              "null"
            ]
          },
          "proposedAt": {
            "type": "string",
            "minLength": 20
          },
          "decidedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "testCopyId",
          "state",
          "changes",
          "conflicts",
          "proposalId",
          "jobId",
          "outcome",
          "proposedAt",
          "decidedAt"
        ],
        "additionalProperties": false
      },
      "GetPurchaseOrderBudgetPositionResponse": {
        "type": "object",
        "properties": {
          "subject": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "BILL",
                  "ORDER"
                ]
              },
              "id": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "additionalProperties": false
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "measuredOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "postingMoved": {
            "type": "boolean"
          },
          "windowLabel": {
            "type": "string"
          },
          "plan": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "state": {
                    "type": "string",
                    "const": "PLAN"
                  },
                  "budgetId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "version": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "fiscalYear": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "state",
                  "budgetId",
                  "name",
                  "version",
                  "fiscalYear"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "state": {
                    "type": "string",
                    "const": "NONE_APPROVED"
                  },
                  "company": {
                    "type": "string"
                  }
                },
                "required": [
                  "state",
                  "company"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "state": {
                    "type": "string",
                    "const": "OTHER_CURRENCY"
                  },
                  "planCurrency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  }
                },
                "required": [
                  "state",
                  "planCurrency"
                ],
                "additionalProperties": false
              }
            ]
          },
          "groups": {
            "maxItems": 100,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "accountId": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "lineIndexes": {
                  "type": "array",
                  "items": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "OVER",
                    "WITHIN",
                    "UNBUDGETED",
                    "NOT_YET_PLANNED",
                    "NOT_BUDGETABLE",
                    "NO_RATE",
                    "TAGS_NOT_COVERED",
                    "MIXED_PLAN_TAGS"
                  ]
                },
                "tagLabels": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "monthPlanMinor": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "planYtdMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "planYearMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "actualMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "committedMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "thisMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "afterMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "overByMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "alreadyOver": {
                  "type": "boolean"
                },
                "firstPlannedMonth": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "accountId",
                "code",
                "name",
                "lineIndexes",
                "state",
                "tagLabels",
                "monthPlanMinor",
                "planYtdMinor",
                "planYearMinor",
                "actualMinor",
                "committedMinor",
                "thisMinor",
                "afterMinor",
                "overByMinor",
                "alreadyOver",
                "firstPlannedMonth"
              ],
              "additionalProperties": false
            }
          },
          "committedBills": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "committedUnmeasuredBills": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "notComparedLines": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "over": {
            "type": "boolean"
          },
          "verdictDigest": {
            "type": "string",
            "pattern": "^[0-9a-f]{16}$"
          },
          "readAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "subject",
          "entityId",
          "entityName",
          "entityTimeZone",
          "currency",
          "measuredOn",
          "postingMoved",
          "windowLabel",
          "plan",
          "groups",
          "committedBills",
          "committedUnmeasuredBills",
          "notComparedLines",
          "over",
          "verdictDigest",
          "readAt"
        ],
        "additionalProperties": false
      },
      "GetPurchaseOrderNumberSeriesResponse": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "padding": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12
          },
          "next": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "nextNumber": {
            "type": "string"
          },
          "issued": {
            "type": [
              "string",
              "null"
            ]
          },
          "updatedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "entityId",
          "prefix",
          "padding",
          "next",
          "nextNumber",
          "issued",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "GetPurchasesSettingsResponse": {
        "type": "object",
        "properties": {
          "ledger": {
            "type": "object",
            "properties": {
              "bankingCallbackWindowDays": {
                "type": "integer",
                "minimum": 1,
                "maximum": 365
              },
              "bankingProposalExpiryDays": {
                "type": "integer",
                "minimum": 1,
                "maximum": 365
              },
              "bankingNoticeTelephone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "newVendorSlipKind": {
                "type": "string",
                "enum": [
                  "NONE",
                  "T4A",
                  "T5018",
                  "T4A_NR"
                ]
              },
              "newVendorAccount": {
                "$ref": "#/components/schemas/Account"
              },
              "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"
                  }
                ]
              },
              "bankingDigitsRetentionDays": {
                "type": "integer",
                "minimum": 7,
                "maximum": 365
              },
              "bankingDigitsRetentionSetBy": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "bankingDigitsRetentionSetAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "bankingDigitsDueCount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "vendorPortalOn": {
                "type": "boolean"
              },
              "vendorPortalOnBy": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "vendorPortalOnAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "vendorPortalLinkDays": {
                "type": "integer",
                "minimum": 7,
                "maximum": 365
              },
              "vendorPortalReadsPerDay": {
                "type": "integer",
                "minimum": 0,
                "maximum": 20
              },
              "vendorPortalLiveLinks": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "vendorPortalWaiting": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "statementRoundingMinor": {
                "type": "integer",
                "minimum": 0,
                "maximum": 500
              },
              "statementLookbackDays": {
                "type": "integer",
                "minimum": 30,
                "maximum": 400
              },
              "statementMatchSetBy": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "statementMatchSetAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "treatmentWindowBills": {
                "type": "integer",
                "minimum": 3,
                "maximum": 12
              },
              "priceCreepBp": {
                "type": "integer",
                "minimum": 100,
                "maximum": 10000
              },
              "priceCreepFloorMinor": {
                "type": "string",
                "pattern": "^\\d+$"
              },
              "expectedBillMinOccurrences": {
                "type": "integer",
                "minimum": 3,
                "maximum": 24
              },
              "expectedBillGraceDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 31
              },
              "recurringToleranceBp": {
                "type": "integer",
                "minimum": 0,
                "maximum": 10000
              },
              "recurringToleranceFloorMinor": {
                "type": "string",
                "pattern": "^\\d+$"
              },
              "duplicateAmountWindowDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 31
              },
              "duplicateCadenceMinMonths": {
                "type": "integer",
                "minimum": 1,
                "maximum": 24
              },
              "duplicateCadenceMaxPerMonth": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10
              },
              "bankingSignalWindowDays": {
                "type": "integer",
                "minimum": 1,
                "maximum": 365
              },
              "bankingShortIntervalDays": {
                "type": "integer",
                "minimum": 1,
                "maximum": 730
              },
              "approvalReminders": {
                "type": "object",
                "properties": {
                  "nudgeAfterDays": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 30
                  },
                  "noticeMode": {
                    "type": "string",
                    "enum": [
                      "EACH",
                      "DAILY_DIGEST"
                    ]
                  }
                },
                "required": [
                  "nudgeAfterDays",
                  "noticeMode"
                ],
                "additionalProperties": false
              },
              "supplierNotices": {
                "type": "object",
                "properties": {
                  "approved": {
                    "type": "string",
                    "enum": [
                      "OFF",
                      "OFFERED",
                      "TICKED"
                    ]
                  },
                  "held": {
                    "type": "string",
                    "enum": [
                      "OFF",
                      "OFFERED",
                      "TICKED"
                    ]
                  },
                  "declined": {
                    "type": "string",
                    "enum": [
                      "OFF",
                      "OFFERED",
                      "TICKED"
                    ]
                  }
                },
                "required": [
                  "approved",
                  "held",
                  "declined"
                ],
                "additionalProperties": false
              },
              "vendorMergeExpiryDays": {
                "type": "integer",
                "minimum": 1,
                "maximum": 60
              },
              "paperLeadDays": {
                "type": "integer",
                "minimum": 1,
                "maximum": 120
              },
              "newVendorRequiredPaper": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "WSIB_CLEARANCE",
                    "INSURANCE_CERTIFICATE",
                    "MASTER_AGREEMENT",
                    "W8BEN",
                    "DIRECT_DEPOSIT_FORM",
                    "WITHHOLDING_WAIVER",
                    "OTHER"
                  ]
                }
              }
            },
            "required": [
              "bankingCallbackWindowDays",
              "bankingProposalExpiryDays",
              "bankingNoticeTelephone",
              "newVendorSlipKind",
              "newVendorAccount",
              "updatedBy",
              "updatedAt",
              "bankingDigitsRetentionDays",
              "bankingDigitsRetentionSetBy",
              "bankingDigitsRetentionSetAt",
              "bankingDigitsDueCount",
              "vendorPortalOn",
              "vendorPortalOnBy",
              "vendorPortalOnAt",
              "vendorPortalLinkDays",
              "vendorPortalReadsPerDay",
              "vendorPortalLiveLinks",
              "vendorPortalWaiting",
              "statementRoundingMinor",
              "statementLookbackDays",
              "statementMatchSetBy",
              "statementMatchSetAt",
              "treatmentWindowBills",
              "priceCreepBp",
              "priceCreepFloorMinor",
              "expectedBillMinOccurrences",
              "expectedBillGraceDays",
              "recurringToleranceBp",
              "recurringToleranceFloorMinor",
              "duplicateAmountWindowDays",
              "duplicateCadenceMinMonths",
              "duplicateCadenceMaxPerMonth",
              "bankingSignalWindowDays",
              "bankingShortIntervalDays",
              "approvalReminders",
              "supplierNotices",
              "vendorMergeExpiryDays",
              "paperLeadDays",
              "newVendorRequiredPaper"
            ],
            "additionalProperties": false
          },
          "entity": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string"
                  },
                  "entityName": {
                    "type": "string"
                  },
                  "entityTimeZone": {
                    "type": "string"
                  },
                  "payableAccount": {
                    "$ref": "#/components/schemas/Account"
                  },
                  "billNumberRequired": {
                    "type": "boolean"
                  },
                  "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"
                      }
                    ]
                  },
                  "bankingLargeBillMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "fxMethod": {
                    "type": "object",
                    "properties": {
                      "method": {
                        "type": "string",
                        "enum": [
                          "BOC_DAILY",
                          "LEDGER_RATE"
                        ]
                      },
                      "setBy": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "setAt": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 20
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "note": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "method",
                      "setBy",
                      "setAt",
                      "note"
                    ],
                    "additionalProperties": false
                  },
                  "unconvertedBillCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "supplierContact": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "user": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "telephone": {
                            "type": "string"
                          },
                          "seatHeld": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "user",
                          "telephone",
                          "seatHeld"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "remittanceSender": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "withholdingPayableAccount": {
                    "$ref": "#/components/schemas/Account"
                  },
                  "inbox": {
                    "type": "object",
                    "properties": {
                      "senderPolicy": {
                        "type": "string",
                        "enum": [
                          "ACCEPT_ALL",
                          "QUARANTINE_UNAUTHENTICATED",
                          "KNOWN_SENDERS_ONLY"
                        ]
                      },
                      "addressDailyMessages": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "senderDailyMessages": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "addressDailyReadMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "senderDailyReadMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "watcherEmailed": {
                        "type": "boolean"
                      },
                      "setBy": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "setAt": {
                        "anyOf": [
                          {
                            "type": "string",
                            "minLength": 20
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "adviceDismissed": {
                        "$ref": "#/components/schemas/StoppedBy"
                      },
                      "heldOpen": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "senderPolicy",
                      "addressDailyMessages",
                      "senderDailyMessages",
                      "addressDailyReadMinor",
                      "senderDailyReadMinor",
                      "watcherEmailed",
                      "setBy",
                      "setAt",
                      "adviceDismissed",
                      "heldOpen"
                    ],
                    "additionalProperties": false
                  },
                  "orderSuggestionsOn": {
                    "type": "boolean"
                  },
                  "receiptOverPercent": {
                    "type": "string"
                  },
                  "receiverNotApprover": {
                    "type": "boolean"
                  },
                  "orderMatchMode": {
                    "type": "string",
                    "enum": [
                      "TWO_WAY",
                      "THREE_WAY"
                    ]
                  },
                  "orderRequiredAboveMinor": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "receivedNotInvoicedAccount": {
                    "$ref": "#/components/schemas/Account"
                  },
                  "prepaidAccount": {
                    "$ref": "#/components/schemas/Account"
                  },
                  "prepaidFloorMinor": {
                    "type": "string"
                  },
                  "prepaidSetBy": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "prepaidSetAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 20
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "expectedBillsOn": {
                    "type": "boolean"
                  },
                  "accruedLiabilitiesAccount": {
                    "$ref": "#/components/schemas/Account"
                  },
                  "holdbackPayableAccount": {
                    "$ref": "#/components/schemas/Account"
                  },
                  "capitalFloorMinor": {
                    "type": "string",
                    "pattern": "^\\d+$"
                  },
                  "capitalReadOn": {
                    "type": "boolean"
                  },
                  "capitalSetBy": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "capitalSetAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 20
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "planAccountId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "cardReceiptGraceDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 30
                  },
                  "intercompanyReadOn": {
                    "type": "boolean"
                  },
                  "intercompanySetBy": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "intercompanySetAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 20
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "entityId",
                  "entityName",
                  "entityTimeZone",
                  "payableAccount",
                  "billNumberRequired",
                  "updatedBy",
                  "updatedAt",
                  "bankingLargeBillMinor",
                  "fxMethod",
                  "unconvertedBillCount",
                  "supplierContact",
                  "remittanceSender",
                  "withholdingPayableAccount",
                  "inbox",
                  "orderSuggestionsOn",
                  "receiptOverPercent",
                  "receiverNotApprover",
                  "orderMatchMode",
                  "orderRequiredAboveMinor",
                  "receivedNotInvoicedAccount",
                  "prepaidAccount",
                  "prepaidFloorMinor",
                  "prepaidSetBy",
                  "prepaidSetAt",
                  "expectedBillsOn",
                  "accruedLiabilitiesAccount",
                  "holdbackPayableAccount",
                  "capitalFloorMinor",
                  "capitalReadOn",
                  "capitalSetBy",
                  "capitalSetAt",
                  "planAccountId",
                  "cardReceiptGraceDays",
                  "intercompanyReadOn",
                  "intercompanySetBy",
                  "intercompanySetAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "verificationMethods": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "enum": [
                    "CALLBACK_KNOWN_NUMBER",
                    "IN_PERSON",
                    "OTHER"
                  ]
                },
                "active": {
                  "type": "boolean"
                },
                "guidance": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "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": [
                "method",
                "active",
                "guidance",
                "updatedBy",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "stored": {
            "type": "boolean"
          },
          "paymentRail": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "OFF",
                  "ON"
                ]
              },
              "connection": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "displayName": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "ACTIVE",
                          "PAUSED",
                          "ERROR",
                          "REVOKED"
                        ]
                      },
                      "environment": {
                        "type": "string",
                        "enum": [
                          "SANDBOX",
                          "PRODUCTION"
                        ]
                      },
                      "fundingSourceLabel": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "connectedBy": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "connectedAt": {
                        "type": "string",
                        "minLength": 20
                      }
                    },
                    "required": [
                      "id",
                      "displayName",
                      "status",
                      "environment",
                      "fundingSourceLabel",
                      "connectedBy",
                      "connectedAt"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "connectionReady": {
                "type": "boolean"
              },
              "enabledBy": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "enabledAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "deployment": {
                "type": "string",
                "enum": [
                  "HELD",
                  "APPROVED"
                ]
              },
              "environment": {
                "type": "string",
                "enum": [
                  "SANDBOX",
                  "PRODUCTION"
                ]
              },
              "unsentPayouts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "state",
              "connection",
              "connectionReady",
              "enabledBy",
              "enabledAt",
              "deployment",
              "environment",
              "unsentPayouts"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ledger",
          "entity",
          "verificationMethods",
          "stored",
          "paymentRail"
        ],
        "additionalProperties": false
      },
      "GetRecordImportResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/Kind2"
          },
          "fileName": {
            "type": "string"
          },
          "format": {
            "type": "string",
            "enum": [
              "CSV",
              "XLSX",
              "IIF",
              "PDF",
              "IMAGE",
              "XML",
              "API"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "READING",
              "REVIEW",
              "APPLIED",
              "FAILED",
              "APPLYING",
              "REVERTED"
            ]
          },
          "counts": {
            "$ref": "#/components/schemas/Counts3"
          },
          "documentId": {
            "type": "string"
          },
          "uploadedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "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"
              }
            ]
          },
          "failure": {
            "type": [
              "string",
              "null"
            ]
          },
          "sourceSystem": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "QUICKBOOKS_ONLINE",
                  "QUICKBOOKS_DESKTOP",
                  "XERO",
                  "SAGE_50",
                  "SPREADSHEET",
                  "OTHER"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sourceSystemLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "apply": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "jobId": {
                    "type": "string"
                  }
                },
                "required": [
                  "jobId"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "read": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "jobId": {
                    "type": "string"
                  }
                },
                "required": [
                  "jobId"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "objectKey": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "mapping": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "columns": {
                    "maxItems": 200,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "index": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 199
                        },
                        "header": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "field": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64,
                              "pattern": "^(?:[a-z][A-Za-z0-9]*|cf\\.[a-z][a-z0-9_]{0,39}|line\\.[a-z][a-z0-9_]{0,39})$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "by": {
                          "type": "string",
                          "enum": [
                            "HEADER",
                            "MODEL",
                            "PERSON"
                          ]
                        },
                        "confidenceBp": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 10000
                        }
                      },
                      "required": [
                        "index",
                        "header",
                        "field",
                        "by",
                        "confidenceBp"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "reading": {
                    "type": "object",
                    "properties": {
                      "format": {
                        "type": "string",
                        "enum": [
                          "CSV",
                          "XLSX",
                          "IIF",
                          "PDF",
                          "IMAGE",
                          "XML",
                          "API"
                        ]
                      },
                      "pages": {
                        "default": null,
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "promptVersion": {
                        "default": null,
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 40
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "modelUsed": {
                        "type": "boolean"
                      },
                      "note": {
                        "default": null,
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 1000
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "format",
                      "pages",
                      "promptVersion",
                      "modelUsed",
                      "note"
                    ],
                    "additionalProperties": false
                  },
                  "heldBack": {
                    "default": {
                      "columns": [],
                      "rows": 0
                    },
                    "type": "object",
                    "properties": {
                      "columns": {
                        "readOnly": true,
                        "maxItems": 200,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "index": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 199
                            },
                            "header": {
                              "type": "string",
                              "maxLength": 200
                            },
                            "reason": {
                              "type": "string",
                              "enum": [
                                "VENDOR_BANKING",
                                "CONVERSION_NOT_POSTED"
                              ]
                            }
                          },
                          "required": [
                            "index",
                            "header",
                            "reason"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "rows": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "columns",
                      "rows"
                    ],
                    "additionalProperties": false
                  },
                  "sourceProposal": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "system": {
                            "type": "string",
                            "enum": [
                              "QUICKBOOKS_ONLINE",
                              "QUICKBOOKS_DESKTOP",
                              "XERO",
                              "SAGE_50",
                              "SPREADSHEET",
                              "OTHER"
                            ]
                          },
                          "basis": {
                            "type": "string",
                            "enum": [
                              "FORMAT",
                              "HEADERS",
                              "MODEL",
                              "CONNECTOR"
                            ]
                          },
                          "headers": {
                            "maxItems": 5,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "maxLength": 200
                            }
                          }
                        },
                        "required": [
                          "system",
                          "basis",
                          "headers"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "columns",
                  "reading",
                  "heldBack",
                  "sourceProposal"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "fillable": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64,
                  "pattern": "^(?:[a-z][A-Za-z0-9]*|cf\\.[a-z][a-z0-9_]{0,39}|line\\.[a-z][a-z0-9_]{0,39})$"
                },
                "empty": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "field",
                "empty"
              ],
              "additionalProperties": false
            }
          },
          "filter": {
            "type": "string",
            "enum": [
              "all",
              "problems",
              "low",
              "disagrees",
              "refused"
            ]
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RowsItem2"
            }
          },
          "rowsNextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "rowsTotal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "priorSystem": {
            "default": {
              "recorded": null,
              "answeredBy": null,
              "answeredAt": null
            },
            "type": "object",
            "properties": {
              "recorded": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "answeredBy": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "answeredAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "recorded",
              "answeredBy",
              "answeredAt"
            ],
            "additionalProperties": false
          },
          "intakeSummary": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "papers": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "rowsWithPaper": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "rowsWithoutPaper": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "notAsked": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "waiting": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "read": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "notRead": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "stale": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "agrees": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "disagrees": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "unusedPapers": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ListBankingIntakeDocumentsResponseItem"
                    }
                  },
                  "lastRun": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "requestedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "requestedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "rowsRequested": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "id",
                          "requestedAt",
                          "requestedBy",
                          "rowsRequested"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "entityTimeZone": {
                    "type": "string"
                  }
                },
                "required": [
                  "papers",
                  "rowsWithPaper",
                  "rowsWithoutPaper",
                  "notAsked",
                  "waiting",
                  "read",
                  "notRead",
                  "stale",
                  "agrees",
                  "disagrees",
                  "unusedPapers",
                  "lastRun",
                  "entityTimeZone"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "entityTimeZone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        },
        "required": [
          "id",
          "kind",
          "fileName",
          "format",
          "status",
          "counts",
          "documentId",
          "uploadedBy",
          "createdAt",
          "approvedBy",
          "approvedAt",
          "failure",
          "apply",
          "read",
          "objectKey",
          "mapping",
          "fillable",
          "filter",
          "rows",
          "rowsNextCursor",
          "rowsTotal",
          "priorSystem",
          "intakeSummary",
          "entityTimeZone"
        ],
        "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
      },
      "GetSearchSourceForDocumentResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "document",
              "inbound-email",
              "record",
              "guide"
            ]
          },
          "title": {
            "type": "string"
          },
          "documentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "inboundEmailId": {
            "type": [
              "string",
              "null"
            ]
          },
          "recordType": {
            "type": [
              "string",
              "null"
            ]
          },
          "recordId": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "preparing",
              "indexed",
              "not-indexed",
              "failed",
              "erased"
            ]
          },
          "notIndexedReason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "too-large",
                  "too-many-pages",
                  "too-many-chunks",
                  "unsupported-type",
                  "no-text",
                  "kind-excluded",
                  "ocr-unavailable"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "failureCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "pages": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "chunkCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "language": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "en",
                  "fr",
                  "other"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "parser": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "docling",
                  "document-ai",
                  "email-text",
                  "record-fields",
                  "markdown"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "hiddenTextChars": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "redactions": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "pipelineVersion": {
            "type": [
              "string",
              "null"
            ]
          },
          "current": {
            "type": "boolean"
          },
          "indexedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "queuedAt": {
            "type": "string",
            "minLength": 20
          },
          "erased": {
            "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"
                  },
                  "requestReference": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "at",
                  "by",
                  "reason",
                  "requestReference"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "kind",
          "title",
          "documentId",
          "inboundEmailId",
          "recordType",
          "recordId",
          "status",
          "notIndexedReason",
          "failureCode",
          "attempts",
          "pages",
          "chunkCount",
          "language",
          "parser",
          "hiddenTextChars",
          "redactions",
          "pipelineVersion",
          "current",
          "indexedAt",
          "queuedAt",
          "erased"
        ],
        "additionalProperties": false
      },
      "GetSenderDomainResponse": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string"
          },
          "domain": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "entityId": {
                    "type": "string"
                  },
                  "entityName": {
                    "type": "string"
                  },
                  "domain": {
                    "type": "string"
                  },
                  "address": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "PENDING",
                      "VERIFIED",
                      "DEGRADED",
                      "REMOVED"
                    ]
                  },
                  "inUse": {
                    "type": "boolean"
                  },
                  "dkim": {
                    "$ref": "#/components/schemas/Dkim"
                  },
                  "returnPath": {
                    "$ref": "#/components/schemas/Dkim"
                  },
                  "dmarcPresent": {
                    "type": "boolean"
                  },
                  "dnsProvider": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "verifiedAt": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "lastCheckedAt": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "dkimRotatedAt": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "degradedReason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "entityId",
                  "entityName",
                  "domain",
                  "address",
                  "status",
                  "inUse",
                  "dkim",
                  "returnPath",
                  "dmarcPresent",
                  "dnsProvider",
                  "verifiedAt",
                  "lastCheckedAt",
                  "dkimRotatedAt",
                  "degradedReason"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "platformAddress": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          }
        },
        "required": [
          "entityId",
          "domain",
          "platformAddress",
          "displayName"
        ],
        "additionalProperties": false
      },
      "GetSendingSettingsResponse": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "senderAddress": {
            "type": "string"
          },
          "senderDisplayName": {
            "type": "string"
          },
          "ownDomain": {
            "type": "boolean"
          },
          "replyToEmail": {
            "type": [
              "string",
              "null"
            ]
          },
          "paymentInstructions": {
            "type": [
              "string",
              "null"
            ]
          },
          "template": {
            "$ref": "#/components/schemas/Template"
          },
          "templateIsDefault": {
            "type": "boolean"
          },
          "documentLabels": {
            "$ref": "#/components/schemas/DocumentLabels"
          },
          "cap": {
            "$ref": "#/components/schemas/Cap"
          },
          "capApplies": {
            "type": "boolean"
          },
          "breaker": {
            "$ref": "#/components/schemas/Breaker"
          },
          "transportReady": {
            "type": "boolean"
          },
          "labelKeys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnValue"
            }
          }
        },
        "required": [
          "entityId",
          "entityName",
          "senderAddress",
          "senderDisplayName",
          "ownDomain",
          "replyToEmail",
          "paymentInstructions",
          "template",
          "templateIsDefault",
          "documentLabels",
          "cap",
          "capApplies",
          "breaker",
          "transportReady",
          "labelKeys"
        ],
        "additionalProperties": false
      },
      "GetSignalResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/Kind4"
          },
          "severity": {
            "type": "string",
            "enum": [
              "CRITICAL",
              "WARNING",
              "INFO"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "OPEN",
              "DISMISSED",
              "CONFIRMED"
            ]
          },
          "sentence": {
            "type": "string"
          },
          "subject": {
            "$ref": "#/components/schemas/Subject"
          },
          "vendor": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "displayName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "entityId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entityName": {
            "type": [
              "string",
              "null"
            ]
          },
          "entityTimeZone": {
            "type": "string"
          },
          "observedAt": {
            "type": "string",
            "minLength": 20
          },
          "raisedBy": {
            "type": "string"
          },
          "raisedFor": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "priorsExamined": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "decision": {
            "$ref": "#/components/schemas/Decision"
          },
          "facts": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "DUPLICATE_BILL"
                  },
                  "verdict": {
                    "type": "string",
                    "enum": [
                      "FLAG",
                      "HARD_STOP"
                    ]
                  },
                  "candidate": {
                    "type": "object",
                    "properties": {
                      "billId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "documentId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "supplierName": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 200
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "invoiceNumber": {
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 120
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "currency": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "totalMinor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "documentDate": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "billId",
                      "documentId"
                    ],
                    "additionalProperties": false
                  },
                  "firings": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "signal": {
                          "type": "string",
                          "enum": [
                            "CONTENT_HASH",
                            "INVOICE_NUMBER",
                            "VENDOR_AMOUNT_WINDOW",
                            "VENDOR_CADENCE",
                            "CODED_FEED_LINE"
                          ]
                        },
                        "priorBillId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "priorSourceTransactionId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "priorEntryId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "priorId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "severity": {
                          "type": "string",
                          "enum": [
                            "FLAG",
                            "HARD_STOP"
                          ]
                        },
                        "reason": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        }
                      },
                      "required": [
                        "signal",
                        "priorId",
                        "reason"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "escalations": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "priorId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "signals": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "CONTENT_HASH",
                              "INVOICE_NUMBER",
                              "VENDOR_AMOUNT_WINDOW",
                              "VENDOR_CADENCE",
                              "CODED_FEED_LINE"
                            ]
                          }
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "priorId",
                        "signals",
                        "reason"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "suppressions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "signal": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "CONTENT_HASH",
                                "INVOICE_NUMBER",
                                "VENDOR_AMOUNT_WINDOW",
                                "VENDOR_CADENCE",
                                "CODED_FEED_LINE"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "priorId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "code": {
                          "type": "string",
                          "enum": [
                            "SAME_SOURCE_RECORD",
                            "CO_PRESENT_IN_SOURCE",
                            "CURRENCY_MISMATCH",
                            "VENDOR_DIFFERENT",
                            "VENDOR_UNRESOLVED",
                            "PAIR_DISMISSED"
                          ]
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "signal",
                        "priorId",
                        "code",
                        "reason"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "anomalyProposalId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "extractionId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "readerPromptVersion": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "backfilledFromAnomalyFlagId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "priorsRead": {
                    "type": "object",
                    "properties": {
                      "vendor": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "vendorCapped": {
                        "type": "boolean"
                      },
                      "unattributed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "unattributedCapped": {
                        "type": "boolean"
                      },
                      "sameFile": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "feedLines": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "vendor",
                      "vendorCapped",
                      "unattributed",
                      "unattributedCapped",
                      "sameFile",
                      "feedLines"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "kind",
                  "verdict",
                  "candidate",
                  "firings",
                  "escalations",
                  "suppressions",
                  "anomalyProposalId",
                  "extractionId",
                  "readerPromptVersion",
                  "backfilledFromAnomalyFlagId"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "HOLDER_NAME_MISMATCH"
                  },
                  "holderName": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "vendorNames": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "initialsMatch": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "kind",
                  "holderName",
                  "vendorNames",
                  "initialsMatch"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "NO_EVIDENCE"
                  }
                },
                "required": [
                  "kind"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "NEW_SENDER_DOMAIN"
                  },
                  "messages": {
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "inboundEmailId": {
                          "type": "string"
                        },
                        "domain": {
                          "type": "string"
                        },
                        "receivedAt": {
                          "type": "string",
                          "minLength": 20
                        },
                        "basis": {
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "RESENT_HEADERS",
                                "AUTO_FORWARD_HEADERS",
                                "ATTACHED_MESSAGE",
                                "INLINE_BLOCK",
                                "SUBJECT_ONLY"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "authPassed": {
                          "type": "boolean"
                        },
                        "lookalikeOf": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "billId": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "carriedTheEvidence": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "inboundEmailId",
                        "domain",
                        "receivedAt",
                        "basis",
                        "authPassed",
                        "lookalikeOf",
                        "billId",
                        "carriedTheEvidence"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "messageCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "knownDomains": {
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "knownCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "windowDays": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "messages",
                  "messageCount",
                  "knownDomains",
                  "knownCount",
                  "windowDays"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "FIRST_TIME_SENDER_DOMAIN"
                  },
                  "inboundEmailId": {
                    "type": "string"
                  },
                  "domain": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "basis": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "RESENT_HEADERS",
                          "AUTO_FORWARD_HEADERS",
                          "ATTACHED_MESSAGE",
                          "INLINE_BLOCK",
                          "SUBJECT_ONLY"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "authPassed": {
                    "type": "boolean"
                  },
                  "auth": {
                    "$ref": "#/components/schemas/Auth"
                  },
                  "knownDomains": {
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "knownCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "lookalikeOf": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "why": {
                            "type": "string",
                            "enum": [
                              "CONFUSABLE",
                              "CONTAINS",
                              "EDIT_DISTANCE"
                            ]
                          }
                        },
                        "required": [
                          "domain",
                          "why"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "retired": {
                    "$ref": "#/components/schemas/Retired2"
                  },
                  "forwardedByName": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "originalSender": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "paymentChangeAnnounced": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  }
                },
                "required": [
                  "kind",
                  "inboundEmailId",
                  "domain",
                  "basis",
                  "authPassed",
                  "auth",
                  "knownDomains",
                  "knownCount",
                  "lookalikeOf",
                  "retired",
                  "forwardedByName",
                  "originalSender",
                  "paymentChangeAnnounced"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "CHANGE_BEFORE_A_LARGE_BILL"
                  },
                  "bills": {
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "billId": {
                          "type": "string"
                        },
                        "number": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "entityId": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "totalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "openMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "dueDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "status": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "billId",
                        "number",
                        "entityId",
                        "currency",
                        "totalMinor",
                        "openMinor",
                        "dueDate",
                        "status"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "billCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "caps": {
                    "$ref": "#/components/schemas/Caps"
                  }
                },
                "required": [
                  "kind",
                  "bills",
                  "billCount",
                  "caps"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "SHORT_INTERVAL"
                  },
                  "previousChangeId": {
                    "type": "string"
                  },
                  "previousStatus": {
                    "type": "string"
                  },
                  "previousAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "daysBetween": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "windowDays": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "previousChangeId",
                  "previousStatus",
                  "previousAt",
                  "daysBetween",
                  "windowDays"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "SHARED_ACCOUNT"
                  },
                  "others": {
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "vendorId": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "inForce": {
                          "type": "boolean"
                        },
                        "vendorArchived": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "vendorId",
                        "displayName",
                        "status",
                        "inForce",
                        "vendorArchived"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "otherCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "sharedAccountReason": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "kind",
                  "others",
                  "otherCount",
                  "sharedAccountReason"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "PRINTED_ACCOUNT_DIFFERS"
                  },
                  "extractionId": {
                    "type": "string"
                  },
                  "printed": {
                    "type": "object",
                    "properties": {
                      "shape": {
                        "type": "string",
                        "enum": [
                          "ROUTING",
                          "ACCOUNT_ONLY"
                        ]
                      },
                      "last4": {
                        "type": "string",
                        "pattern": "^[0-9]{4}$"
                      },
                      "count": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10
                      }
                    },
                    "required": [
                      "shape",
                      "last4",
                      "count"
                    ],
                    "additionalProperties": false
                  },
                  "onFile": {
                    "type": "object",
                    "properties": {
                      "changeId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "changeId"
                    ],
                    "additionalProperties": false
                  },
                  "matchesPendingChangeId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "paymentChangeAnnounced": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "promptVersion": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "kind",
                  "extractionId",
                  "printed",
                  "onFile",
                  "matchesPendingChangeId",
                  "paymentChangeAnnounced",
                  "promptVersion"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "DOCUMENT_EXPIRING"
                  },
                  "stage": {
                    "type": "string",
                    "enum": [
                      "EXPIRING",
                      "LAPSED"
                    ]
                  },
                  "vendorDocumentId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "documentKind": {
                    "type": "string",
                    "enum": [
                      "WSIB_CLEARANCE",
                      "INSURANCE_CERTIFICATE",
                      "MASTER_AGREEMENT",
                      "W8BEN",
                      "DIRECT_DEPOSIT_FORM",
                      "WITHHOLDING_WAIVER",
                      "OTHER"
                    ]
                  },
                  "title": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 160
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "validUntil": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "days": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "required": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "kind",
                  "stage",
                  "vendorDocumentId",
                  "documentKind",
                  "title",
                  "validUntil",
                  "days",
                  "required"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "AGREEMENT_RENEWING"
                  },
                  "stage": {
                    "type": "string",
                    "enum": [
                      "ACT_SOON",
                      "ACT_BY_PASSED",
                      "UNTOLD"
                    ]
                  },
                  "vendorAgreementId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "entityName": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "renewal": {
                    "type": "string",
                    "enum": [
                      "AUTO_RENEWS",
                      "ENDS",
                      "OPEN_ENDED"
                    ]
                  },
                  "endsOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "actBy": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "days": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "ownerName": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "decision": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "RENEW",
                          "LET_END"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "kind",
                  "stage",
                  "vendorAgreementId",
                  "name",
                  "entityId",
                  "entityName",
                  "renewal",
                  "endsOn",
                  "actBy",
                  "days",
                  "ownerName",
                  "decision"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "SLIP_IDENTITY_INCOMPLETE"
                  },
                  "slipKind": {
                    "type": "string",
                    "enum": [
                      "T4A",
                      "T5018"
                    ]
                  },
                  "taxYear": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "periodEnd": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "dueDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "entityId": {
                    "type": "string"
                  },
                  "entityName": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "measuredMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "projectedMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "thresholdMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "crossed": {
                    "type": "boolean"
                  },
                  "gapCodes": {
                    "minItems": 1,
                    "maxItems": 6,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "RECIPIENT_TYPE",
                        "SURNAME",
                        "LEGAL_NAME",
                        "BUSINESS_NUMBER",
                        "PROVINCE",
                        "COUNTRY"
                      ]
                    }
                  },
                  "addressIncomplete": {
                    "type": "boolean"
                  },
                  "paymentCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "slipKind",
                  "taxYear",
                  "periodEnd",
                  "dueDate",
                  "entityId",
                  "entityName",
                  "measuredMinor",
                  "projectedMinor",
                  "thresholdMinor",
                  "crossed",
                  "gapCodes",
                  "addressIncomplete",
                  "paymentCount"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "SLIP_KIND_QUESTIONED"
                  },
                  "taxYear": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "periodEnd": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "entityId": {
                    "type": "string"
                  },
                  "entityName": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "verdict": {
                    "type": "string",
                    "enum": [
                      "SUBCONTRACT_CONSTRUCTION",
                      "SERVICES_FEES"
                    ]
                  },
                  "suggestedKind": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "T4A",
                          "T5018"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "suggestionNote": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 300
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "measuredMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "thresholdMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "quote": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "note": {
                    "type": "string",
                    "maxLength": 160
                  },
                  "evidence": {
                    "minItems": 1,
                    "maxItems": 12,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "lineRef": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "billId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "billLineId": {
                          "type": "string",
                          "minLength": 1
                        },
                        "billNumber": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 120
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "accountName": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 120
                        },
                        "netMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "lineRef",
                        "billId",
                        "billLineId",
                        "billNumber",
                        "accountName",
                        "description",
                        "netMinor"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "readingId": {
                    "type": "string"
                  },
                  "promptVersion": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "earlier": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "taxYear": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "dismissedOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "by": {
                            "type": "string",
                            "maxLength": 120
                          },
                          "reason": {
                            "type": "string",
                            "maxLength": 500
                          }
                        },
                        "required": [
                          "taxYear",
                          "dismissedOn",
                          "by",
                          "reason"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "kind",
                  "taxYear",
                  "periodEnd",
                  "entityId",
                  "entityName",
                  "verdict",
                  "suggestedKind",
                  "suggestionNote",
                  "measuredMinor",
                  "thresholdMinor",
                  "quote",
                  "note",
                  "evidence",
                  "readingId",
                  "promptVersion",
                  "earlier"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "EXPECTED_BILL_MISSING"
                  },
                  "entityId": {
                    "type": "string"
                  },
                  "entityName": {
                    "type": "string"
                  },
                  "month": {
                    "type": "string",
                    "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                  },
                  "intervalMonths": {
                    "anyOf": [
                      {
                        "type": "number",
                        "const": 1
                      },
                      {
                        "type": "number",
                        "const": 3
                      }
                    ]
                  },
                  "usualDay": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 31
                  },
                  "graceDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 31
                  },
                  "dueOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "medianSubtotalMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "lastBills": {
                    "minItems": 1,
                    "maxItems": 12,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "billId": {
                          "type": "string"
                        },
                        "number": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "billDate": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "subtotalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "billId",
                        "number",
                        "billDate",
                        "subtotalMinor"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "basisBillIds": {
                    "minItems": 3,
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "monthsObserved": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "firstMonth": {
                    "type": "string",
                    "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
                  },
                  "missedInARow": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3
                  }
                },
                "required": [
                  "kind",
                  "entityId",
                  "entityName",
                  "month",
                  "intervalMonths",
                  "usualDay",
                  "graceDays",
                  "dueOn",
                  "currency",
                  "medianSubtotalMinor",
                  "lastBills",
                  "basisBillIds",
                  "monthsObserved",
                  "firstMonth",
                  "missedInARow"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "RECURRING_AMOUNT_MOVED"
                  },
                  "scheduleId": {
                    "type": "string"
                  },
                  "scheduleName": {
                    "type": "string"
                  },
                  "occurrence": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "thisSubtotalMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "thisTaxMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "thisTotalMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "last": {
                    "type": "object",
                    "properties": {
                      "billId": {
                        "type": "string"
                      },
                      "number": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "billDate": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "scheduledFor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "subtotalMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "totalMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      }
                    },
                    "required": [
                      "billId",
                      "number",
                      "billDate",
                      "scheduledFor",
                      "subtotalMinor",
                      "totalMinor"
                    ],
                    "additionalProperties": false
                  },
                  "deltaMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "deltaBp": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "direction": {
                    "type": "string",
                    "enum": [
                      "ABOVE",
                      "BELOW"
                    ]
                  },
                  "dismissedBefore": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "scheduleId",
                  "scheduleName",
                  "occurrence",
                  "currency",
                  "thisSubtotalMinor",
                  "thisTaxMinor",
                  "thisTotalMinor",
                  "last",
                  "deltaMinor",
                  "deltaBp",
                  "direction",
                  "dismissedBefore"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "TAX_TREATMENT_DRIFT"
                  },
                  "tupleVersion": {
                    "type": "number",
                    "const": 1
                  },
                  "candidate": {
                    "$ref": "#/components/schemas/Candidate"
                  },
                  "lines": {
                    "minItems": 1,
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "positions": {
                          "minItems": 1,
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "accountId": {
                          "type": "string"
                        },
                        "accountCode": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "accountName": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "supplyCategory": {
                          "type": "string",
                          "enum": [
                            "GOODS",
                            "SERVICES",
                            "INTANGIBLE_PROPERTY",
                            "REAL_PROPERTY"
                          ]
                        },
                        "candidate": {
                          "$ref": "#/components/schemas/Candidate2"
                        },
                        "overridden": {
                          "type": "boolean"
                        },
                        "usual": {
                          "type": "object",
                          "properties": {
                            "tuple": {
                              "$ref": "#/components/schemas/Candidate2"
                            },
                            "votes": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "of": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "tuple",
                            "votes",
                            "of"
                          ],
                          "additionalProperties": false
                        },
                        "basisBills": {
                          "minItems": 3,
                          "maxItems": 12,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "billId": {
                                "type": "string"
                              },
                              "number": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 60
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "billDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "votedForUsual": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "billId",
                              "number",
                              "billDate",
                              "votedForUsual"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "billsExamined": {
                          "type": "integer",
                          "minimum": 3,
                          "maximum": 12
                        },
                        "acceptKey": {
                          "type": "string",
                          "maxLength": 400
                        }
                      },
                      "required": [
                        "positions",
                        "accountId",
                        "accountCode",
                        "accountName",
                        "supplyCategory",
                        "candidate",
                        "overridden",
                        "usual",
                        "basisBills",
                        "billsExamined",
                        "acceptKey"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "omittedLines": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "tupleVersion",
                  "candidate",
                  "lines",
                  "omittedLines"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "PRICE_CREEP"
                  },
                  "candidate": {
                    "$ref": "#/components/schemas/Candidate"
                  },
                  "lines": {
                    "minItems": 1,
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "position": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "accountId": {
                          "type": "string"
                        },
                        "accountCode": {
                          "type": "string",
                          "maxLength": 40
                        },
                        "accountName": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 200
                        },
                        "descriptionKey": {
                          "type": "string",
                          "maxLength": 120,
                          "pattern": "^[a-z]+( [a-z]+)*$"
                        },
                        "unitPriceMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "unitPriceSource": {
                          "type": "string",
                          "enum": [
                            "STATED",
                            "IMPLIED"
                          ]
                        },
                        "medianMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "referenceMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "accepted": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "unitPriceMinor": {
                                  "type": "string",
                                  "pattern": "^-?\\d+$"
                                },
                                "byName": {
                                  "type": "string",
                                  "maxLength": 120
                                },
                                "at": {
                                  "type": "string",
                                  "minLength": 20
                                }
                              },
                              "required": [
                                "unitPriceMinor",
                                "byName",
                                "at"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "riseBp": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "basis": {
                          "minItems": 3,
                          "maxItems": 12,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "billId": {
                                "type": "string"
                              },
                              "number": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 60
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "billDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "unitPriceMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              }
                            },
                            "required": [
                              "billId",
                              "number",
                              "billDate",
                              "unitPriceMinor"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "otherCurrencyBills": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "acceptKey": {
                          "type": "string",
                          "maxLength": 400
                        }
                      },
                      "required": [
                        "position",
                        "accountId",
                        "accountCode",
                        "accountName",
                        "description",
                        "descriptionKey",
                        "unitPriceMinor",
                        "unitPriceSource",
                        "medianMinor",
                        "referenceMinor",
                        "accepted",
                        "riseBp",
                        "basis",
                        "otherCurrencyBills",
                        "acceptKey"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "omittedLines": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "candidate",
                  "lines",
                  "omittedLines"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "CAPITAL_PURCHASE"
                  },
                  "billId": {
                    "type": "string"
                  },
                  "vendorId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "linePosition": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "accountId": {
                    "type": "string"
                  },
                  "accountCode": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "accountName": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "gifiCode": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 4,
                        "maxLength": 4
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "accountBasis": {
                    "type": "string",
                    "enum": [
                      "GIFI_CAPITAL_BAND",
                      "ASSET_ACCOUNT_IN_REGISTER",
                      "INVESTING_ASSET_ACCOUNT"
                    ]
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "quantity": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "functionalCurrency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "netMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "costMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "perUnitCostMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "floorMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "country": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 2
                  },
                  "classProposal": {
                    "type": "object",
                    "properties": {
                      "ccaClass": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "1",
                              "3",
                              "6",
                              "8",
                              "10",
                              "12",
                              "16",
                              "43",
                              "44",
                              "46",
                              "50",
                              "53",
                              "54",
                              "55",
                              "56",
                              "10.1",
                              "14.1",
                              "43.1",
                              "43.2"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "basis": {
                        "type": "string",
                        "enum": [
                          "ACCOUNT_TABLE",
                          "NONE"
                        ]
                      },
                      "menu": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "1",
                            "3",
                            "6",
                            "8",
                            "10",
                            "12",
                            "16",
                            "43",
                            "44",
                            "46",
                            "50",
                            "53",
                            "54",
                            "55",
                            "56",
                            "10.1",
                            "14.1",
                            "43.1",
                            "43.2"
                          ]
                        }
                      },
                      "vehicle": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "ccaClass",
                      "basis",
                      "menu",
                      "vehicle"
                    ],
                    "additionalProperties": false
                  },
                  "acquiredOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "inServiceOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "kind",
                  "billId",
                  "vendorId",
                  "linePosition",
                  "revision",
                  "accountId",
                  "accountCode",
                  "accountName",
                  "gifiCode",
                  "accountBasis",
                  "description",
                  "quantity",
                  "currency",
                  "functionalCurrency",
                  "netMinor",
                  "costMinor",
                  "perUnitCostMinor",
                  "floorMinor",
                  "country",
                  "classProposal",
                  "acquiredOn",
                  "inServiceOn"
                ],
                "additionalProperties": false
              }
            ]
          },
          "policy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "vendorAmountWindowDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 31
                  },
                  "minMonthsForCadence": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 24
                  },
                  "maxBillsPerMonthForCadence": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10
                  }
                },
                "required": [
                  "vendorAmountWindowDays",
                  "minMonthsForCadence",
                  "maxBillsPerMonthForCadence"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "bankingSignalWindowDays": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 365
                  },
                  "bankingShortIntervalDays": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 730
                  },
                  "largeBillCaps": {
                    "$ref": "#/components/schemas/Caps"
                  }
                },
                "required": [
                  "bankingSignalWindowDays",
                  "bankingShortIntervalDays",
                  "largeBillCaps"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "leadDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 120
                  },
                  "lapseLookbackDays": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 366
                  }
                },
                "required": [
                  "leadDays",
                  "lapseLookbackDays"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "thresholdMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "windowMonths": {
                    "type": "number",
                    "const": 3
                  },
                  "projectionMinDays": {
                    "type": "number",
                    "const": 60
                  },
                  "readsPerRunMax": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "readIntervalDays": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "readsPerVendorYearMax": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "thresholdMinor",
                  "windowMonths",
                  "projectionMinDays",
                  "readsPerRunMax",
                  "readIntervalDays",
                  "readsPerVendorYearMax"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "minOccurrences": {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 24
                  },
                  "graceDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 31
                  }
                },
                "required": [
                  "minOccurrences",
                  "graceDays"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "toleranceBp": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000
                  },
                  "floorMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  }
                },
                "required": [
                  "toleranceBp",
                  "floorMinor"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "taxDriftWindowBills": {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 12
                  },
                  "taxDriftMinBills": {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 3
                  }
                },
                "required": [
                  "taxDriftWindowBills",
                  "taxDriftMinBills"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "priceCreepWindowBills": {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 12
                  },
                  "priceCreepMinBills": {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 3
                  },
                  "priceCreepBp": {
                    "type": "integer",
                    "minimum": 100,
                    "maximum": 10000
                  },
                  "priceCreepFloorMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  }
                },
                "required": [
                  "priceCreepWindowBills",
                  "priceCreepMinBills",
                  "priceCreepBp",
                  "priceCreepFloorMinor"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "capitalFloorMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "floorBasis": {
                    "type": "string",
                    "const": "PER_UNIT_COST"
                  },
                  "bandFromGifi": {
                    "type": "string",
                    "const": "1600"
                  },
                  "bandToGifi": {
                    "type": "string",
                    "const": "2179"
                  }
                },
                "required": [
                  "capitalFloorMinor",
                  "floorBasis",
                  "bandFromGifi",
                  "bandToGifi"
                ],
                "additionalProperties": false
              }
            ]
          },
          "baseline": {
            "type": "object",
            "properties": {
              "keyCount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "after": {
                "anyOf": [
                  {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "DUPLICATE_BILL"
                          },
                          "clearedPairs": {
                            "minItems": 1,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "a": {
                                  "type": "string"
                                },
                                "b": {
                                  "type": "string"
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 300
                                }
                              },
                              "required": [
                                "a",
                                "b",
                                "label"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "kind",
                          "clearedPairs"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "HOLDER_NAME_MISMATCH",
                              "NO_EVIDENCE",
                              "NEW_SENDER_DOMAIN",
                              "CHANGE_BEFORE_A_LARGE_BILL",
                              "SHORT_INTERVAL",
                              "SHARED_ACCOUNT",
                              "FIRST_TIME_SENDER_DOMAIN",
                              "PRINTED_ACCOUNT_DIFFERS"
                            ]
                          },
                          "decidedBy": {
                            "type": "string",
                            "enum": [
                              "VERIFY",
                              "REJECT"
                            ]
                          }
                        },
                        "required": [
                          "kind",
                          "decidedBy"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "FIRST_TIME_SENDER_DOMAIN",
                              "PRINTED_ACCOUNT_DIFFERS",
                              "SLIP_IDENTITY_INCOMPLETE",
                              "SLIP_KIND_QUESTIONED"
                            ]
                          },
                          "decidedBy": {
                            "type": "string",
                            "const": "DISMISS"
                          }
                        },
                        "required": [
                          "kind",
                          "decidedBy"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "DOCUMENT_EXPIRING",
                              "AGREEMENT_RENEWING"
                            ]
                          },
                          "decidedBy": {
                            "type": "string",
                            "enum": [
                              "DISMISS",
                              "WITHDRAWN",
                              "MERGED"
                            ]
                          }
                        },
                        "required": [
                          "kind",
                          "decidedBy"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "EXPECTED_BILL_MISSING"
                          },
                          "decidedBy": {
                            "type": "string",
                            "const": "DISMISS"
                          },
                          "scope": {
                            "type": "string",
                            "enum": [
                              "THIS_MONTH",
                              "SUPPLIER_FOR_A_YEAR"
                            ]
                          },
                          "until": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "kind",
                          "decidedBy",
                          "scope",
                          "until"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "RECURRING_AMOUNT_MOVED"
                          },
                          "decidedBy": {
                            "type": "string",
                            "const": "DISMISS"
                          }
                        },
                        "required": [
                          "kind",
                          "decidedBy"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "TAX_TREATMENT_DRIFT"
                              },
                              "accepted": {
                                "minItems": 1,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "accountCode": {
                                      "type": "string",
                                      "maxLength": 40
                                    },
                                    "supplyCategory": {
                                      "type": "string",
                                      "enum": [
                                        "GOODS",
                                        "SERVICES",
                                        "INTANGIBLE_PROPERTY",
                                        "REAL_PROPERTY"
                                      ]
                                    },
                                    "tuple": {
                                      "$ref": "#/components/schemas/Candidate2"
                                    }
                                  },
                                  "required": [
                                    "accountCode",
                                    "supplyCategory",
                                    "tuple"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "kind",
                              "accepted"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "PRICE_CREEP"
                              },
                              "accepted": {
                                "minItems": 1,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "key": {
                                      "type": "string",
                                      "maxLength": 400
                                    },
                                    "description": {
                                      "type": "string",
                                      "maxLength": 200
                                    },
                                    "unitPriceMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "currency": {
                                      "type": "string",
                                      "pattern": "^[A-Z]{3}$"
                                    },
                                    "fromBillDate": {
                                      "type": "string",
                                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                    }
                                  },
                                  "required": [
                                    "key",
                                    "description",
                                    "unitPriceMinor",
                                    "currency",
                                    "fromBillDate"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "kind",
                              "accepted"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "CAPITAL_PURCHASE"
                          },
                          "decidedBy": {
                            "type": "string",
                            "enum": [
                              "DISMISS",
                              "BILL_VOIDED",
                              "LINE_CHANGED"
                            ]
                          },
                          "vendorId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "accountId": {
                            "type": "string"
                          },
                          "digest": {
                            "type": "string",
                            "minLength": 64,
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "kind",
                          "decidedBy",
                          "vendorId",
                          "accountId",
                          "digest"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "keyCount",
              "after"
            ],
            "additionalProperties": false
          },
          "fingerprint": {
            "type": "string",
            "minLength": 64,
            "maxLength": 64
          },
          "standing": {
            "anyOf": [
              {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "EXPECTED_BILL_MISSING"
                      },
                      "arrived": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "billId": {
                                "type": "string"
                              },
                              "number": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "billDate": {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              "status": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "billId",
                              "number",
                              "billDate",
                              "status"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "accrual": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "entryId": {
                                "type": "string"
                              },
                              "entryNumber": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "entryStatus": {
                                "type": "string"
                              },
                              "amountMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "currency": {
                                "type": "string",
                                "pattern": "^[A-Z]{3}$"
                              },
                              "proposedBy": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name"
                                ],
                                "additionalProperties": false
                              },
                              "declined": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "by": {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "name"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "reason": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "by",
                                      "reason"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "entryId",
                              "entryNumber",
                              "entryStatus",
                              "amountMinor",
                              "currency",
                              "proposedBy",
                              "declined"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "markedUntil": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "arrived",
                      "accrual",
                      "markedUntil"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "RECURRING_AMOUNT_MOVED"
                      },
                      "schedule": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "frequency": {
                            "type": "string"
                          },
                          "nextRunDate": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "active": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "frequency",
                          "nextRunDate",
                          "active"
                        ],
                        "additionalProperties": false
                      },
                      "templateSubtotalMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "follows": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "billId": {
                                "type": "string"
                              },
                              "number": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "billId",
                              "number"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "schedule",
                      "templateSubtotalMinor",
                      "follows"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "CAPITAL_PURCHASE"
                      },
                      "billStatus": {
                        "type": "string"
                      },
                      "billNumber": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "line": {
                        "anyOf": [
                          {
                            "$ref": "#/components/schemas/LineOption1"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "closedBy": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "BILL_VOIDED",
                              "LINE_CHANGED"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "kind",
                      "billStatus",
                      "billNumber",
                      "line",
                      "closedBy"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "kind",
          "severity",
          "state",
          "sentence",
          "subject",
          "vendor",
          "entityId",
          "entityName",
          "entityTimeZone",
          "observedAt",
          "raisedBy",
          "raisedFor",
          "priorsExamined",
          "decision",
          "facts",
          "policy",
          "baseline",
          "fingerprint",
          "standing"
        ],
        "additionalProperties": false
      },
      "GetUndoGroupResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "ledgerId": {
            "type": "string"
          },
          "appName": {
            "type": [
              "string",
              "null"
            ]
          },
          "door": {
            "type": "string",
            "enum": [
              "web",
              "rest",
              "mcp"
            ]
          },
          "personName": {
            "type": "string"
          },
          "openedAt": {
            "type": "string",
            "minLength": 20
          },
          "lastWriteAt": {
            "type": "string",
            "minLength": 20
          },
          "expiresAt": {
            "type": "string",
            "minLength": 20
          },
          "recordCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "confirmedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "undoneAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "undoneByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "IN_PLACE",
              "UNDONE",
              "PARTLY_UNDONE",
              "UNDO_PROPOSED"
            ]
          },
          "open": {
            "type": "boolean"
          },
          "mayUndo": {
            "type": "boolean"
          },
          "secondPerson": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "waiting": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "approved": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "declinedProposalIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "waiting",
                  "approved",
                  "declinedProposalIds"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "ledgerId",
          "appName",
          "door",
          "personName",
          "openedAt",
          "lastWriteAt",
          "expiresAt",
          "recordCount",
          "confirmedAt",
          "undoneAt",
          "undoneByName",
          "state",
          "open",
          "mayUndo",
          "secondPerson"
        ],
        "additionalProperties": false
      },
      "GetVendorNoticeResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/Kind5"
          },
          "state": {
            "type": "string",
            "enum": [
              "DRAFTED",
              "SENT",
              "SUPPRESSED",
              "BOUNCED"
            ]
          },
          "reason": {
            "$ref": "#/components/schemas/Reason"
          },
          "recipientEmail": {
            "type": "string"
          },
          "language": {
            "type": "string",
            "enum": [
              "en",
              "fr",
              "bilingual"
            ]
          },
          "subject": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "entity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "entityTimeZone": {
            "type": "string"
          },
          "address": {
            "$ref": "#/components/schemas/Address"
          },
          "vendor": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "displayName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "inboundEmailId": {
            "type": [
              "string",
              "null"
            ]
          },
          "inboundRefusalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "digestNoticeId": {
            "type": [
              "string",
              "null"
            ]
          },
          "digestHourStart": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "under": {
            "$ref": "#/components/schemas/Under"
          },
          "stoppedBy": {
            "$ref": "#/components/schemas/StoppedBy"
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "sentAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "sentVia": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "PRODUCT",
                  "BY_HAND"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sentBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "sentNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "transport": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "postmark",
                  "log",
                  "test-copy"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "bouncedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "bounceReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "relayRefusal": {
            "type": [
              "string",
              "null"
            ]
          },
          "draftedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "discarded": {
            "$ref": "#/components/schemas/Retired"
          },
          "sendable": {
            "type": "boolean"
          },
          "outboundApproved": {
            "type": "boolean"
          },
          "sentence": {
            "type": "string"
          },
          "payment": {
            "$ref": "#/components/schemas/Payment"
          },
          "requested": {
            "$ref": "#/components/schemas/StoppedBy"
          },
          "recipientNew": {
            "type": "boolean"
          },
          "recipientConfirmedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "bill": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "number"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "vendorBankingChangeId": {
            "type": [
              "string",
              "null"
            ]
          },
          "slipDistribution": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "reference"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "purchaseOrder": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "number"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "vendorPortalLink": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "contactName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "contactName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "vendorQuery": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "reference"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "vendorStatement": {
            "$ref": "#/components/schemas/VendorStatement"
          },
          "body": {
            "type": "string"
          },
          "from": {
            "type": "object",
            "properties": {
              "address": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "address",
              "name"
            ],
            "additionalProperties": false
          },
          "providerMessageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "messageVersion": {
            "type": "string"
          },
          "foldedCount": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "facts": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "language": {
                    "type": "string",
                    "enum": [
                      "en",
                      "fr"
                    ]
                  },
                  "vendorName": {
                    "type": "string"
                  },
                  "recipientName": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "companyName": {
                    "type": "string"
                  },
                  "billTo": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "address": {
                    "type": "string"
                  },
                  "paymentTermsName": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "contact": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "telephone": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name",
                      "telephone"
                    ],
                    "additionalProperties": false
                  },
                  "situation": {
                    "type": "string",
                    "enum": [
                      "NEW_SUPPLIER",
                      "NOT_USING_AN_INBOX",
                      "ALREADY_USING_AN_INBOX"
                    ]
                  },
                  "paragraph": {
                    "type": "object",
                    "properties": {
                      "source": {
                        "type": "string",
                        "enum": [
                          "STANDARD",
                          "AGENT_DRAFT",
                          "AGENT_DRAFT_EDITED",
                          "PERSON"
                        ]
                      },
                      "text": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "source",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  "thresholds": {
                    "type": "object",
                    "properties": {
                      "currency": {
                        "type": "string"
                      },
                      "lowerMinor": {
                        "type": "string"
                      },
                      "upperMinor": {
                        "type": "string"
                      },
                      "source": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "currency",
                      "lowerMinor",
                      "upperMinor",
                      "source"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "language",
                  "vendorName",
                  "recipientName",
                  "companyName",
                  "billTo",
                  "address",
                  "paymentTermsName",
                  "contact",
                  "situation",
                  "paragraph",
                  "thresholds"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "remittance": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "number",
                    "const": 1
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "ADVICE",
                      "REVERSAL"
                    ]
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "en",
                      "fr",
                      "bilingual"
                    ]
                  },
                  "company": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "legalName": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "name",
                      "legalName"
                    ],
                    "additionalProperties": false
                  },
                  "vendor": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "displayName": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "displayName"
                    ],
                    "additionalProperties": false
                  },
                  "recipient": {
                    "type": "object",
                    "properties": {
                      "email": {
                        "type": "string"
                      },
                      "name": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "email",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "payment": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "runId": {
                        "type": "string"
                      },
                      "sequence": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9007199254740991
                      },
                      "paymentDate": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "amountMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "currency": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      }
                    },
                    "required": [
                      "id",
                      "runId",
                      "sequence",
                      "paymentDate",
                      "amountMinor",
                      "currency"
                    ],
                    "additionalProperties": false
                  },
                  "lines": {
                    "$ref": "#/components/schemas/Lines"
                  },
                  "totals": {
                    "type": "object",
                    "properties": {
                      "appliedMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "creditsMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "discountsMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "withholdingMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "paidMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      }
                    },
                    "required": [
                      "appliedMinor",
                      "creditsMinor",
                      "discountsMinor",
                      "withholdingMinor",
                      "paidMinor"
                    ],
                    "additionalProperties": false
                  },
                  "contact": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "telephone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "name",
                          "telephone"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reference": {
                    "type": "string"
                  },
                  "situation": {
                    "type": "string",
                    "enum": [
                      "PAID_IN_FULL",
                      "WITH_DEDUCTIONS",
                      "SHORT"
                    ]
                  },
                  "paragraph": {
                    "type": "object",
                    "properties": {
                      "source": {
                        "type": "string",
                        "enum": [
                          "STANDARD",
                          "PERSON",
                          "AGENT_DRAFT",
                          "AGENT_DRAFT_EDITED"
                        ]
                      },
                      "text": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "promptVersion": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "source",
                      "text",
                      "promptVersion"
                    ],
                    "additionalProperties": false
                  },
                  "releasedAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "entityTimeZone": {
                    "type": "string"
                  },
                  "reversal": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "adviceReference": {
                            "type": "string"
                          },
                          "adviceSentOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "reversedOn": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "returnWords": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "adviceReference",
                          "adviceSentOn",
                          "reversedOn",
                          "returnWords"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "instrument": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "method": {
                            "type": "string",
                            "enum": [
                              "EFT",
                              "CHEQUE",
                              "WIRE"
                            ]
                          },
                          "chequeNumber": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "accountLast4": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[0-9A-Z]{4}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "printedName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "crossReference": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "originatorShortName": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "method",
                          "chequeNumber",
                          "accountLast4",
                          "printedName",
                          "crossReference",
                          "originatorShortName"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "version",
                  "kind",
                  "language",
                  "company",
                  "vendor",
                  "recipient",
                  "payment",
                  "lines",
                  "totals",
                  "contact",
                  "reference",
                  "situation",
                  "paragraph",
                  "releasedAt",
                  "entityTimeZone",
                  "reversal",
                  "instrument"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "decisionFacts": {
            "$ref": "#/components/schemas/DecisionFacts"
          },
          "paperFacts": {
            "$ref": "#/components/schemas/PaperFacts"
          }
        },
        "required": [
          "id",
          "kind",
          "state",
          "reason",
          "recipientEmail",
          "language",
          "subject",
          "reference",
          "entity",
          "entityTimeZone",
          "address",
          "vendor",
          "inboundEmailId",
          "inboundRefusalId",
          "digestNoticeId",
          "digestHourStart",
          "under",
          "stoppedBy",
          "createdAt",
          "sentAt",
          "sentVia",
          "sentBy",
          "sentNote",
          "transport",
          "bouncedAt",
          "bounceReason",
          "relayRefusal",
          "draftedBy",
          "discarded",
          "sendable",
          "outboundApproved",
          "sentence",
          "payment",
          "requested",
          "recipientNew",
          "recipientConfirmedBy",
          "bill",
          "vendorBankingChangeId",
          "slipDistribution",
          "purchaseOrder",
          "vendorPortalLink",
          "vendorQuery",
          "vendorStatement",
          "body",
          "from",
          "providerMessageId",
          "messageVersion",
          "foldedCount",
          "facts",
          "remittance",
          "decisionFacts",
          "paperFacts"
        ],
        "additionalProperties": false
      },
      "GetVendorPortalSubmissionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "vendor": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "displayName"
            ],
            "additionalProperties": false
          },
          "kind": {
            "type": "string",
            "enum": [
              "DOCUMENT",
              "FACTS",
              "PAPER",
              "BANKING"
            ]
          },
          "summary": {
            "type": "string"
          },
          "receivedAt": {
            "type": "string",
            "minLength": 20
          },
          "waitingDays": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "RECEIVED",
              "ACCEPTED",
              "DECLINED",
              "WITHDRAWN"
            ]
          },
          "decidedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "entityTimeZone": {
            "type": "string"
          },
          "link": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "contactName": {
                "type": "string"
              },
              "issuedBy": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "issuedAt": {
                "type": "string",
                "minLength": 20
              },
              "opens": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "id",
              "contactName",
              "issuedBy",
              "issuedAt",
              "opens"
            ],
            "additionalProperties": false
          },
          "facts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "enum": [
                    "legalName",
                    "taxNumber",
                    "qstNumber",
                    "recipientType",
                    "surname",
                    "givenName",
                    "addressLine1",
                    "addressLine2",
                    "city",
                    "region",
                    "postalCode",
                    "country"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "current": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "proposed": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "NEW",
                    "CHANGED",
                    "SAME"
                  ]
                },
                "readFromPage": {
                  "type": "boolean"
                },
                "changedBySupplier": {
                  "type": "boolean"
                }
              },
              "required": [
                "key",
                "label",
                "current",
                "proposed",
                "status",
                "readFromPage",
                "changedBySupplier"
              ],
              "additionalProperties": false
            }
          },
          "paper": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string"
                  },
                  "validFrom": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "validUntil": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "readDates": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "from": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "until": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "from",
                          "until"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "kind",
                  "validFrom",
                  "validUntil",
                  "readDates",
                  "title"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "banking": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "holderName": {
                    "type": "string"
                  },
                  "holderMatchesLegalName": {
                    "type": "string",
                    "enum": [
                      "AGREES",
                      "DIFFERS",
                      "NOT_FOUND"
                    ]
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "NEW_ACCOUNT",
                      "CHANGED_BANK",
                      "CORRECTION"
                    ]
                  },
                  "callback": {
                    "type": "object",
                    "properties": {
                      "onFile": {
                        "type": "boolean"
                      },
                      "endsWith": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "onFile",
                      "endsWith"
                    ],
                    "additionalProperties": false
                  },
                  "existingState": {
                    "type": "string",
                    "enum": [
                      "ON_FILE",
                      "NONE",
                      "CHANGE_BEING_CHECKED"
                    ]
                  }
                },
                "required": [
                  "holderName",
                  "holderMatchesLegalName",
                  "reason",
                  "callback",
                  "existingState"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "document": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "fileName": {
                    "type": "string"
                  },
                  "sensitive": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "id",
                  "fileName",
                  "sensitive"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "flags": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "sentence": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "sentence"
              ],
              "additionalProperties": false
            }
          },
          "decision": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "by": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "at": {
                    "type": "string",
                    "minLength": 20
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "declineReasonCode": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "UNCLEAR_COPY",
                          "WRONG_DOCUMENT",
                          "ALREADY_ON_FILE",
                          "WILL_CALL",
                          "WRITE_TO_US"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "by",
                  "at",
                  "note",
                  "declineReasonCode"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "readUsed": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "vendor",
          "kind",
          "summary",
          "receivedAt",
          "waitingDays",
          "state",
          "decidedBy",
          "entityTimeZone",
          "link",
          "facts",
          "paper",
          "banking",
          "document",
          "flags",
          "decision",
          "readUsed"
        ],
        "additionalProperties": false
      },
      "GetVendorStatementNoticeFactsResponse": {
        "type": "object",
        "properties": {
          "facts": {
            "type": "object",
            "properties": {
              "theirsOnly": {
                "$ref": "#/components/schemas/TheirsOnly"
              },
              "oursOnly": {
                "$ref": "#/components/schemas/TheirsOnly"
              },
              "differs": {
                "$ref": "#/components/schemas/TheirsOnly"
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "statementDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              }
            },
            "required": [
              "theirsOnly",
              "oursOnly",
              "differs",
              "currency",
              "statementDate"
            ],
            "additionalProperties": false
          },
          "preview": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "subject": {
                    "type": "string"
                  },
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "subject",
                  "text"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "recipients": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "email": {
                  "type": "string"
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "email",
                "name"
              ],
              "additionalProperties": false
            }
          },
          "openDraft": {
            "$ref": "#/components/schemas/OpenDraft"
          },
          "lastSent": {
            "$ref": "#/components/schemas/LastSent"
          },
          "outboundApproved": {
            "type": "boolean"
          },
          "entityTimeZone": {
            "type": "string"
          }
        },
        "required": [
          "facts",
          "preview",
          "recipients",
          "openDraft",
          "lastSent",
          "outboundApproved",
          "entityTimeZone"
        ],
        "additionalProperties": false
      },
      "GetYearEndSettingsResponse": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string"
          },
          "functionalCurrency": {
            "type": "string"
          },
          "allowanceMethod": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "AGEING_BUCKETS",
                  "SPECIFIC_PROVISIONS",
                  "COMBINED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "allowanceAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "badDebtAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "unrealizedFxAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "rates": {
            "minItems": 5,
            "maxItems": 5,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RatesItem"
            }
          },
          "provisionsInForce": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "updatedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "updatedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "entityId",
          "functionalCurrency",
          "allowanceMethod",
          "allowanceAccount",
          "badDebtAccount",
          "unrealizedFxAccount",
          "rates",
          "provisionsInForce",
          "updatedAt",
          "updatedBy"
        ],
        "additionalProperties": false
      },
      "Head": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "field": {
              "type": "string"
            },
            "before": {
              "type": "string"
            },
            "after": {
              "type": "string"
            }
          },
          "required": [
            "field",
            "before",
            "after"
          ],
          "additionalProperties": false
        }
      },
      "Held": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "pattern": "^(0|[1-9]\\d{0,18})$"
              },
              "since": {
                "type": "string",
                "minLength": 20
              },
              "code": {
                "type": "string"
              },
              "attempts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "from",
              "since",
              "code",
              "attempts"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "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
        }
      },
      "Hold": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "held": {
                "default": true,
                "type": "boolean",
                "const": true
              },
              "since": {
                "type": "string",
                "minLength": 20
              }
            },
            "required": [
              "held",
              "since"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "HoldBillResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "hold": {
            "$ref": "#/components/schemas/Hold"
          }
        },
        "required": [
          "id",
          "hold"
        ],
        "additionalProperties": false
      },
      "Holdback": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "NONE",
              "RETAINED",
              "RELEASE_DUE",
              "RELEASE_DRAFTED",
              "PART_RELEASED",
              "RELEASED",
              "IS_RELEASE"
            ]
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "grossMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "retainedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "releasedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "draftedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "remainingMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "bp": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "authority": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "STATUTE",
                  "AGREEMENT"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "authorityNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "releaseOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "account": {
            "$ref": "#/components/schemas/Account"
          },
          "statedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "statedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "PERSON",
                  "AGENT_DRAFT",
                  "AGENT_DRAFT_EDITED",
                  "CARRIED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "of": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "billId": {
                    "type": "string"
                  },
                  "number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "billDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "supplierName": {
                    "type": "string"
                  }
                },
                "required": [
                  "billId",
                  "number",
                  "billDate",
                  "supplierName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "releases": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "billId": {
                  "type": "string"
                },
                "number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string"
                },
                "subtotalMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "taxMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "totalMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "billDate": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "paid": {
                  "type": "boolean"
                }
              },
              "required": [
                "billId",
                "number",
                "status",
                "subtotalMinor",
                "taxMinor",
                "totalMinor",
                "billDate",
                "paid"
              ],
              "additionalProperties": false
            }
          },
          "releasesTotal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "releasesNextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "finding": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "const": "HOLDBACK_UNSTATED"
                  },
                  "fact": {
                    "type": "string"
                  },
                  "remedy": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "fact",
                  "remedy"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "entityTimeZone": {
            "type": "string"
          }
        },
        "required": [
          "state",
          "currency",
          "grossMinor",
          "retainedMinor",
          "releasedMinor",
          "draftedMinor",
          "remainingMinor",
          "bp",
          "authority",
          "authorityNote",
          "releaseOn",
          "account",
          "statedBy",
          "statedAt",
          "source",
          "of",
          "releases",
          "releasesTotal",
          "releasesNextCursor",
          "finding",
          "entityTimeZone"
        ],
        "additionalProperties": false
      },
      "HubSpotDealsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "amountMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "stage": {
            "type": "string"
          },
          "closeDate": {
            "type": "string"
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "customerId": {
            "type": [
              "string",
              "null"
            ]
          },
          "customerName": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "description": {
                  "type": "string"
                },
                "quantity": {
                  "type": "string"
                },
                "unitPriceMinor": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "description",
                "quantity",
                "unitPriceMinor"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "name",
          "amountMinor",
          "stage",
          "closeDate",
          "currency",
          "customerId",
          "customerName",
          "lines"
        ],
        "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
        }
      },
      "Input": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/InputOption1"
          },
          {
            "type": "null"
          }
        ]
      },
      "InputOption1": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {},
        "description": "A JSON Schema (draft 2020-12) document: the generated operation's input, query or output for this ledger's custom object.",
        "x-open-by-reference": true
      },
      "Invoice": {
        "type": "object",
        "properties": {
          "billId": {
            "type": "string"
          },
          "number": {
            "type": [
              "string",
              "null"
            ]
          },
          "date": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "totalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "dueDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          }
        },
        "required": [
          "billId",
          "number",
          "date",
          "totalMinor",
          "currency",
          "dueDate"
        ],
        "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
      },
      "Job2": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Job"
          },
          {
            "type": "null"
          }
        ]
      },
      "Keys": {
        "maxItems": 6,
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/KeysItem"
        }
      },
      "KeysItem": {
        "type": "string",
        "enum": [
          "BILL_RECEIVED",
          "BILL_STATE",
          "BILL_AMOUNTS",
          "BILL_HELD_TOLD",
          "BILL_DECLINED_TOLD",
          "PAYMENT_PAID",
          "PAYMENT_APPLIED",
          "PAYMENT_DEDUCTIONS",
          "SHORT_PAY_REASON",
          "ADVICE_SENT",
          "CREDIT_STATUS"
        ]
      },
      "Kind2": {
        "type": "string",
        "enum": [
          "CUSTOMER",
          "PRODUCT",
          "VENDOR",
          "FIXED_ASSET",
          "TAX_REGISTRATION",
          "CONTRACT",
          "CREDIT_MEMO",
          "JOURNAL_ENTRY",
          "BUDGET",
          "RULE",
          "HISTORY_AUDIT_LINE",
          "HISTORY_CONTROL_FIRING",
          "HISTORY_PERIOD_LOCK",
          "HISTORY_REPORT_PACK",
          "HISTORY_SLIP_FILE",
          "HISTORY_FX_RATE",
          "HISTORY_SCHEDULE",
          "HISTORY_QUEUE_DECISION",
          "HISTORY_TAX_OVERRIDE",
          "BILL",
          "RECEIPT",
          "APPROVAL_AUTHORITY",
          "VENDOR_CREDIT",
          "CUSTOMER_PRICE",
          "PURCHASE_ORDER",
          "OPEN_PAYABLE",
          "VENDOR_BANKING",
          "HISTORY_PAID_BILL",
          "HISTORY_VENDOR_PAYMENT",
          "CUSTOM_RECORD"
        ]
      },
      "Kind3": {
        "type": "string",
        "enum": [
          "HOLDER_NAME_MISMATCH",
          "NO_EVIDENCE",
          "NEW_SENDER_DOMAIN",
          "FIRST_TIME_SENDER_DOMAIN",
          "CHANGE_BEFORE_A_LARGE_BILL",
          "SHORT_INTERVAL",
          "SHARED_ACCOUNT",
          "PRINTED_ACCOUNT_DIFFERS"
        ]
      },
      "Kind4": {
        "type": "string",
        "enum": [
          "DUPLICATE_BILL",
          "HOLDER_NAME_MISMATCH",
          "NO_EVIDENCE",
          "NEW_SENDER_DOMAIN",
          "FIRST_TIME_SENDER_DOMAIN",
          "CHANGE_BEFORE_A_LARGE_BILL",
          "SHORT_INTERVAL",
          "SHARED_ACCOUNT",
          "PRINTED_ACCOUNT_DIFFERS",
          "DOCUMENT_EXPIRING",
          "AGREEMENT_RENEWING",
          "SLIP_IDENTITY_INCOMPLETE",
          "SLIP_KIND_QUESTIONED",
          "EXPECTED_BILL_MISSING",
          "RECURRING_AMOUNT_MOVED",
          "TAX_TREATMENT_DRIFT",
          "PRICE_CREEP",
          "CAPITAL_PURCHASE"
        ]
      },
      "Kind5": {
        "type": "string",
        "enum": [
          "RECEIVED",
          "COULD_NOT_READ",
          "REFUSED",
          "QUARANTINED",
          "DIGEST",
          "HANDOFF",
          "REMITTANCE_ADVICE",
          "REMITTANCE_REVERSAL",
          "BILL_APPROVED",
          "BILL_HELD",
          "BILL_DECLINED",
          "CORRECTION_ASKED",
          "ADDRESS_CLOSING",
          "BANKING_CHANGED",
          "DOCUMENT_REQUESTED",
          "NON_RENEWAL_NOTICE",
          "SLIP_COPY",
          "SLIP_IDENTITY_ASK",
          "HELD",
          "PURCHASE_ORDER",
          "PURCHASE_ORDER_CANCELLED",
          "PORTAL_INVITATION",
          "QUERY_ANSWER",
          "QUERY_ASKED",
          "STATEMENT_QUERY",
          "ACCOUNT_STATEMENT",
          "PORTAL_DECISION"
        ]
      },
      "Kind6": {
        "type": "string",
        "enum": [
          "GST_HST_RETURN",
          "QST_RETURN",
          "PAYROLL_REMITTANCE",
          "CORPORATE_INSTALMENT",
          "T2_RETURN",
          "CORPORATE_BALANCE",
          "T4_SLIPS",
          "T4A_SLIPS",
          "T5_SLIPS",
          "T5018_SLIPS",
          "ANNUAL_RETURN",
          "EHT_RETURN",
          "EHT_INSTALMENT",
          "WSIB_RECONCILIATION",
          "NR_WITHHOLDING_REMITTANCE",
          "T4A_NR_SLIPS"
        ]
      },
      "Kind7": {
        "type": "string",
        "enum": [
          "BILL",
          "SALES_INVOICE",
          "RECORD_IMPORT",
          "VENDOR_BANKING_EVIDENCE",
          "VENDOR_REGISTRATION_EVIDENCE",
          "PAYMENT_BANK_NOTICE",
          "CUSTOMER_CREDIT_APPLICATION",
          "EXEMPTION_CERTIFICATE",
          "SALES_EVIDENCE",
          "VENDOR_PAPER",
          "SUPPLIER_QUOTE",
          "GOODS_RECEIPT_EVIDENCE",
          "RECORDS_DESTRUCTION_PERMISSION",
          "VENDOR_STATEMENT"
        ]
      },
      "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
      },
      "LastSent": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "on": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "byName": {
                "type": "string"
              },
              "recipientEmail": {
                "type": "string"
              }
            },
            "required": [
              "on",
              "byName",
              "recipientEmail"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Later": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "entityId": {
              "type": "string"
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "bills": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "openMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "firstOn": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "lastOn": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "entityId",
            "currency",
            "bills",
            "openMinor",
            "firstOn",
            "lastOn"
          ],
          "additionalProperties": false
        }
      },
      "LatestFile": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/LatestFileOption1"
          },
          {
            "type": "null"
          }
        ]
      },
      "LatestFileOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "producedAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "fileName",
          "producedAt"
        ],
        "additionalProperties": false
      },
      "Line": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "postedOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "amountMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "description": {
            "type": "string"
          },
          "counterparty": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "NEW",
              "PROPOSED",
              "MATCHED",
              "IGNORED"
            ]
          },
          "ageDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "postedOn",
          "amountMinor",
          "currency",
          "description",
          "counterparty",
          "reference",
          "state",
          "ageDays"
        ],
        "additionalProperties": false
      },
      "LineOption1": {
        "type": "object",
        "properties": {
          "position": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "lineId": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": "string"
          },
          "account": {
            "$ref": "#/components/schemas/Account3"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "netMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "costMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "perUnitCostMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "FLAGGED",
              "REGISTERED",
              "PARTLY_REGISTERED",
              "SET_ASIDE",
              "CLEARED_EARLIER",
              "BELOW_FLOOR",
              "NOT_DEPRECIABLE",
              "NO_RATE",
              "CLOSED"
            ]
          },
          "signal": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "OPEN",
                      "DISMISSED",
                      "CONFIRMED"
                    ]
                  },
                  "observedAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "decision": {
                    "$ref": "#/components/schemas/Decision2"
                  },
                  "closedBy": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "BILL_VOIDED",
                          "LINE_CHANGED"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "state",
                  "observedAt",
                  "decision",
                  "closedBy"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "clearedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "signalId": {
                    "type": "string"
                  },
                  "byName": {
                    "type": "string"
                  },
                  "at": {
                    "type": "string",
                    "minLength": 20
                  },
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "signalId",
                  "byName",
                  "at",
                  "reason"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "reading": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "state": {
                    "type": "string",
                    "enum": [
                      "OFF",
                      "WAITING",
                      "STOPPED",
                      "READ",
                      "NOTHING_STATED",
                      "FAILED",
                      "NOT_ASKED"
                    ]
                  },
                  "outcome": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "READ",
                          "NOTHING_STATED",
                          "UNSANE",
                          "UNPARSABLE",
                          "REFUSED",
                          "DISCLOSURE",
                          "BUDGET",
                          "PROVIDER",
                          "STOPPED_AFTER_DECLINES"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "ccaClass": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "1",
                          "3",
                          "6",
                          "8",
                          "10",
                          "12",
                          "16",
                          "43",
                          "44",
                          "46",
                          "50",
                          "53",
                          "54",
                          "55",
                          "56",
                          "10.1",
                          "14.1",
                          "43.1",
                          "43.2"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "inServiceOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "promptVersion": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "readAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 20
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "attempts": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 3
                  },
                  "mayReadAgain": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "state",
                  "outcome",
                  "id",
                  "ccaClass",
                  "inServiceOn",
                  "promptVersion",
                  "readAt",
                  "attempts",
                  "mayReadAgain"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "assets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "costMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "ccaClass": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "1",
                        "3",
                        "6",
                        "8",
                        "10",
                        "12",
                        "16",
                        "43",
                        "44",
                        "46",
                        "50",
                        "53",
                        "54",
                        "55",
                        "56",
                        "10.1",
                        "14.1",
                        "43.1",
                        "43.2"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "ACTIVE",
                    "DISPOSED",
                    "FULLY_DEPRECIATED"
                  ]
                },
                "createdAt": {
                  "type": "string",
                  "minLength": 20
                }
              },
              "required": [
                "id",
                "name",
                "costMinor",
                "ccaClass",
                "status",
                "createdAt"
              ],
              "additionalProperties": false
            }
          },
          "registeredMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "remainingMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "prefill": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "entity": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "country": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 2
                      },
                      "functionalCurrency": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      "timeZone": {
                        "type": "string"
                      },
                      "region": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "country",
                      "functionalCurrency",
                      "timeZone",
                      "region"
                    ],
                    "additionalProperties": false
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "acquiredOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "inServiceOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "costMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "remainingMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "ccaClass": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "1",
                          "3",
                          "6",
                          "8",
                          "10",
                          "12",
                          "16",
                          "43",
                          "44",
                          "46",
                          "50",
                          "53",
                          "54",
                          "55",
                          "56",
                          "10.1",
                          "14.1",
                          "43.1",
                          "43.2"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ccaClassBasis": {
                    "type": "string",
                    "enum": [
                      "ACCOUNT_TABLE",
                      "READING",
                      "NONE"
                    ]
                  },
                  "ccaClassFacts": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "ccaClass": {
                            "type": "string",
                            "enum": [
                              "1",
                              "3",
                              "6",
                              "8",
                              "10",
                              "12",
                              "16",
                              "43",
                              "44",
                              "46",
                              "50",
                              "53",
                              "54",
                              "55",
                              "56",
                              "10.1",
                              "14.1",
                              "43.1",
                              "43.2"
                            ]
                          },
                          "description": {
                            "type": "string"
                          },
                          "rateE5": {
                            "type": "string",
                            "pattern": "^\\d+$"
                          }
                        },
                        "required": [
                          "ccaClass",
                          "description",
                          "rateE5"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "menu": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "1",
                        "3",
                        "6",
                        "8",
                        "10",
                        "12",
                        "16",
                        "43",
                        "44",
                        "46",
                        "50",
                        "53",
                        "54",
                        "55",
                        "56",
                        "10.1",
                        "14.1",
                        "43.1",
                        "43.2"
                      ]
                    }
                  },
                  "vehicle": {
                    "type": "boolean"
                  },
                  "inServiceBasis": {
                    "type": "string",
                    "enum": [
                      "BILL_DATE",
                      "READING"
                    ]
                  },
                  "method": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "STRAIGHT_LINE",
                          "DECLINING_BALANCE"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "usefulLifeMonths": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "decliningRatePct": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "assetAccount": {
                    "$ref": "#/components/schemas/Account3"
                  },
                  "accumulatedAccount": {
                    "$ref": "#/components/schemas/AccumulatedAccount"
                  },
                  "expenseAccount": {
                    "$ref": "#/components/schemas/AccumulatedAccount"
                  },
                  "basedOnAssetId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "entity",
                  "name",
                  "description",
                  "acquiredOn",
                  "inServiceOn",
                  "costMinor",
                  "remainingMinor",
                  "ccaClass",
                  "ccaClassBasis",
                  "ccaClassFacts",
                  "menu",
                  "vehicle",
                  "inServiceBasis",
                  "method",
                  "usefulLifeMonths",
                  "decliningRatePct",
                  "assetAccount",
                  "accumulatedAccount",
                  "expenseAccount",
                  "basedOnAssetId"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "blocked": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "sentence": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "sentence"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "basisDigest": {
            "type": "string",
            "minLength": 32,
            "maxLength": 32
          }
        },
        "required": [
          "position",
          "lineId",
          "description",
          "quantity",
          "account",
          "currency",
          "netMinor",
          "costMinor",
          "perUnitCostMinor",
          "state",
          "signal",
          "clearedBy",
          "reading",
          "assets",
          "registeredMinor",
          "remainingMinor",
          "prefill",
          "blocked",
          "basisDigest"
        ],
        "additionalProperties": false
      },
      "Lines": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "billId": {
              "type": "string"
            },
            "billNumber": {
              "type": [
                "string",
                "null"
              ]
            },
            "billDate": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "billTotalMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "appliedMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "deductions": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "CREDIT",
                      "DISCOUNT",
                      "WITHHOLDING"
                    ]
                  },
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "reason": {
                    "type": "string"
                  },
                  "sourceLabel": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "discount": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "bp": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "days": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "discountDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          }
                        },
                        "required": [
                          "bp",
                          "days",
                          "discountDate"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "kind",
                  "amountMinor",
                  "reason",
                  "sourceLabel",
                  "discount"
                ],
                "additionalProperties": false
              }
            },
            "paidMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "leftOpenMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "shortReason": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "billId",
            "billNumber",
            "billDate",
            "billTotalMinor",
            "appliedMinor",
            "deductions",
            "paidMinor",
            "leftOpenMinor",
            "shortReason"
          ],
          "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
        }
      },
      "Lines3": {
        "minItems": 1,
        "maxItems": 100,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "description": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            "accountId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1
                },
                {
                  "type": "null"
                }
              ]
            },
            "quantity": {
              "default": "1",
              "type": "string",
              "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
            },
            "unitPriceMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "netMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "taxAsPrintedMinor": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "supplyCategory": {
              "type": "string",
              "enum": [
                "GOODS",
                "SERVICES",
                "INTANGIBLE_PROPERTY",
                "REAL_PROPERTY"
              ]
            },
            "itcKind": {
              "type": "string",
              "enum": [
                "GENERAL",
                "MEALS_ENTERTAINMENT",
                "PASSENGER_VEHICLE",
                "ZERO_EMISSION_VEHICLE",
                "EXEMPT_ACTIVITY",
                "NONE"
              ]
            },
            "dimensions": {
              "$ref": "#/components/schemas/Dimensions2"
            },
            "servicePeriodStart": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "servicePeriodEnd": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "purchaseOrderLineId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1
                },
                {
                  "type": "null"
                }
              ]
            },
            "customFields": {
              "$ref": "#/components/schemas/CustomFields5"
            }
          },
          "required": [
            "description",
            "supplyCategory",
            "itcKind"
          ],
          "additionalProperties": false
        }
      },
      "Lines4": {
        "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+$"
            },
            "taxAsPrintedMinor": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "supplyCategory": {
              "type": "string",
              "enum": [
                "GOODS",
                "SERVICES",
                "INTANGIBLE_PROPERTY",
                "REAL_PROPERTY"
              ]
            },
            "itcKind": {
              "type": "string",
              "enum": [
                "GENERAL",
                "MEALS_ENTERTAINMENT",
                "PASSENGER_VEHICLE",
                "ZERO_EMISSION_VEHICLE",
                "EXEMPT_ACTIVITY",
                "NONE"
              ]
            },
            "commercialUsePct": {
              "type": [
                "string",
                "null"
              ]
            },
            "provincialServiceKind": {
              "default": null,
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "ACCOUNTING",
                    "ARCHITECTURAL_OR_ENGINEERING",
                    "SECURITY",
                    "NON_RESIDENTIAL_REAL_ESTATE",
                    "ADVERTISING",
                    "ACCOMMODATION"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "provincialBase": {
              "default": null,
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "IN_BASE",
                    "OUTSIDE_BASE"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "provincialExemption": {
              "default": null,
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "RESALE"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "propertyRegion": {
              "default": null,
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "CA-AB",
                    "CA-BC",
                    "CA-MB",
                    "CA-NB",
                    "CA-NL",
                    "CA-NS",
                    "CA-NT",
                    "CA-NU",
                    "CA-ON",
                    "CA-PE",
                    "CA-QC",
                    "CA-SK",
                    "CA-YT"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "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"
                }
              ]
            },
            "taxMinor": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "treatment": {
              "type": [
                "string",
                "null"
              ]
            },
            "purchaseOrderLine": {
              "default": null,
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "orderId": {
                      "type": "string"
                    },
                    "orderNumber": {
                      "type": "string"
                    },
                    "position": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "id",
                    "orderId",
                    "orderNumber",
                    "position"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "heldBackMinor": {
              "default": "0",
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "customFields": {
              "description": "The line's own fields, by the field's key.",
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "type": [
                  "string",
                  "boolean"
                ]
              },
              "x-stability-level": "beta"
            },
            "carriedFrom": {
              "$ref": "#/components/schemas/CarriedFrom"
            }
          },
          "required": [
            "position",
            "description",
            "account",
            "quantity",
            "unitPriceMinor",
            "netMinor",
            "taxAsPrintedMinor",
            "supplyCategory",
            "itcKind",
            "commercialUsePct",
            "provincialServiceKind",
            "provincialBase",
            "provincialExemption",
            "propertyRegion",
            "dimensions",
            "servicePeriodStart",
            "servicePeriodEnd",
            "taxMinor",
            "treatment",
            "purchaseOrderLine",
            "heldBackMinor"
          ],
          "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
        }
      },
      "Lines6": {
        "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": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "netMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "supplyCategory": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "GOODS",
                    "SERVICES",
                    "INTANGIBLE_PROPERTY",
                    "REAL_PROPERTY"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "expectedDate": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "dimensions": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "label"
                    ],
                    "additionalProperties": false
                  },
                  "value": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "code": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "code",
                      "name"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "type",
                  "value"
                ],
                "additionalProperties": false
              }
            },
            "customFields": {
              "description": "The line's own fields, by the field's key.",
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "type": [
                  "string",
                  "boolean"
                ]
              },
              "x-stability-level": "beta"
            },
            "carriedFrom": {
              "$ref": "#/components/schemas/CarriedFrom"
            }
          },
          "required": [
            "id",
            "position",
            "description",
            "account",
            "quantity",
            "unitPriceMinor",
            "netMinor",
            "supplyCategory",
            "expectedDate",
            "dimensions"
          ],
          "additionalProperties": false
        }
      },
      "Lines7": {
        "minItems": 1,
        "maxItems": 200,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "purchaseOrderLineId": {
              "type": "string",
              "minLength": 1
            },
            "quantity": {
              "type": "string",
              "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
            },
            "note": {
              "default": null,
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 300
                },
                {
                  "type": "null"
                }
              ]
            },
            "customFields": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{0,39}$"
              },
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 500
                  },
                  {
                    "type": "boolean"
                  }
                ]
              }
            }
          },
          "required": [
            "purchaseOrderLineId",
            "quantity"
          ],
          "additionalProperties": false
        }
      },
      "Lines8": {
        "minItems": 1,
        "maxItems": 100,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "description": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            },
            "accountId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1
                },
                {
                  "type": "null"
                }
              ]
            },
            "quantity": {
              "default": "1",
              "type": "string",
              "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
            },
            "unitPriceMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "netMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "taxAsPrintedMinor": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "supplyCategory": {
              "type": "string",
              "enum": [
                "GOODS",
                "SERVICES",
                "INTANGIBLE_PROPERTY",
                "REAL_PROPERTY"
              ]
            },
            "itcKind": {
              "type": "string",
              "enum": [
                "GENERAL",
                "MEALS_ENTERTAINMENT",
                "PASSENGER_VEHICLE",
                "ZERO_EMISSION_VEHICLE",
                "EXEMPT_ACTIVITY",
                "NONE"
              ]
            },
            "dimensions": {
              "$ref": "#/components/schemas/Dimensions2"
            },
            "servicePeriodStart": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "servicePeriodEnd": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            },
            "purchaseOrderLineId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1
                },
                {
                  "type": "null"
                }
              ]
            },
            "customFields": {
              "$ref": "#/components/schemas/CustomFields5"
            },
            "adjustsBillLineId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "description",
            "supplyCategory",
            "itcKind"
          ],
          "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
        }
      },
      "LinesItem": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "accountId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "quantity": {
            "type": "string",
            "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
          },
          "unitPriceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "supplyCategory": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "GOODS",
                  "SERVICES",
                  "INTANGIBLE_PROPERTY",
                  "REAL_PROPERTY"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "expectedDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "dimensions": {
            "default": [],
            "maxItems": 10,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DimensionsItem"
            }
          },
          "customFields": {
            "$ref": "#/components/schemas/CustomFields5"
          }
        },
        "required": [
          "description",
          "accountId",
          "quantity",
          "unitPriceMinor",
          "supplyCategory",
          "expectedDate"
        ],
        "additionalProperties": false
      },
      "LinesItem2": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "billId": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "number": {
            "type": [
              "string",
              "null"
            ]
          },
          "rank": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "decision": {
            "type": "string",
            "enum": [
              "TAKEN",
              "SKIPPED"
            ]
          },
          "skipReason": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SkipReasonOption1"
              },
              {
                "type": "null"
              }
            ]
          },
          "detail": {
            "type": [
              "string",
              "null"
            ]
          },
          "openMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "cashMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          }
        },
        "required": [
          "id",
          "billId",
          "supplierName",
          "number",
          "rank",
          "decision",
          "skipReason",
          "detail",
          "openMinor",
          "cashMinor",
          "currency"
        ],
        "additionalProperties": false
      },
      "LinkBillSupersedeResponse": {
        "type": "object",
        "properties": {
          "billId": {
            "type": "string"
          },
          "supersede": {
            "type": "object",
            "properties": {
              "replaces": {
                "$ref": "#/components/schemas/Replaces"
              },
              "replacedBy": {
                "$ref": "#/components/schemas/Replaces"
              },
              "correctionsTotal": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "offer": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "billId": {
                        "type": "string"
                      },
                      "supplierName": {
                        "type": "string"
                      },
                      "number": {
                        "type": "string"
                      },
                      "billDate": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "totalMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "currency": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      "differences": {
                        "minItems": 1,
                        "maxItems": 3,
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/DifferencesItem"
                        }
                      }
                    },
                    "required": [
                      "billId",
                      "supplierName",
                      "number",
                      "billDate",
                      "totalMinor",
                      "currency",
                      "differences"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "next": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "standing": {
                        "type": "string",
                        "enum": [
                          "DRAFT",
                          "IN_REVIEW",
                          "OPEN",
                          "IN_RUN",
                          "EDIT_PENDING",
                          "PAID",
                          "VOID"
                        ]
                      },
                      "sentence": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "standing",
                      "sentence"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "replaces",
              "replacedBy",
              "correctionsTotal",
              "offer",
              "next"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "billId",
          "supersede"
        ],
        "additionalProperties": false
      },
      "LinkVendorResponse": {
        "type": "object",
        "properties": {
          "vendorId": {
            "type": "string"
          },
          "links": {
            "$ref": "#/components/schemas/Links"
          }
        },
        "required": [
          "vendorId",
          "links"
        ],
        "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
        }
      },
      "List": {
        "type": "string",
        "enum": [
          "vendors",
          "bills",
          "billsDue",
          "paymentRuns",
          "purchaseOrders",
          "arrivals",
          "documents",
          "vendorNotices",
          "signals",
          "vendorCredits",
          "vendorMerges",
          "billInbox",
          "expectedBills",
          "bankingWorklist",
          "vendorQueries",
          "vendorStatements"
        ]
      },
      "ListAccountCertificationsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "accountId": {
            "type": "string"
          },
          "accountCode": {
            "type": "string"
          },
          "accountName": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "periodYear": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodMonth": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodEnd": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "ledgerBalanceMinor": {
            "type": "string"
          },
          "supportBalanceMinor": {
            "type": "string"
          },
          "differenceMinor": {
            "type": "string"
          },
          "currentLedgerBalanceMinor": {
            "type": "string"
          },
          "stale": {
            "type": "boolean"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "evidenceDocumentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "certifiedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "certifiedAt": {
            "type": "string",
            "minLength": 20
          },
          "withdrawnBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "withdrawnAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "withdrawReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "supportSourceKind": {
            "type": "string",
            "enum": [
              "TYPED",
              "SUBLEDGER"
            ]
          },
          "supportComputedMinor": {
            "type": [
              "string",
              "null"
            ]
          },
          "computedDifferenceMinor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "accountId",
          "accountCode",
          "accountName",
          "entityId",
          "entityName",
          "periodYear",
          "periodMonth",
          "periodEnd",
          "ledgerBalanceMinor",
          "supportBalanceMinor",
          "differenceMinor",
          "currentLedgerBalanceMinor",
          "stale",
          "note",
          "evidenceDocumentId",
          "certifiedBy",
          "certifiedAt",
          "withdrawnBy",
          "withdrawnAt",
          "withdrawReason",
          "supportSourceKind",
          "supportComputedMinor",
          "computedDifferenceMinor"
        ],
        "additionalProperties": false
      },
      "ListAiProviderFaultsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "occurredAt": {
            "type": "string",
            "minLength": 20
          },
          "feature": {
            "type": "string"
          },
          "featureGroup": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "DOCUMENT_READING",
                  "CODING_AND_MATCHING",
                  "DRAFTING",
                  "CHAT",
                  "EVALUATION"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "providerId": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "modelLocation": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "RATE_LIMITED",
              "SERVER_ERROR",
              "TIMEOUT",
              "UNREACHABLE"
            ]
          },
          "httpStatus": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "PASSED_OVER",
              "NO_MEMBER_LEFT"
            ]
          },
          "passedOverTo": {
            "type": [
              "string",
              "null"
            ]
          },
          "elapsedMs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "documentId": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "occurredAt",
          "feature",
          "featureGroup",
          "providerId",
          "model",
          "modelLocation",
          "kind",
          "httpStatus",
          "outcome",
          "passedOverTo",
          "elapsedMs",
          "documentId"
        ],
        "additionalProperties": false
      },
      "ListApiKeysResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "access": {
            "type": "string",
            "enum": [
              "READ",
              "READ_DRAFT"
            ]
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "state": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "EXPIRING",
              "EXPIRED",
              "REVOKED",
              "PENDING"
            ]
          },
          "standing": {
            "type": "string",
            "enum": [
              "active",
              "paused_standing",
              "stopped_maker_left",
              "stopped_ledger_closed"
            ]
          },
          "daysLeft": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "createdBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "expiresAt": {
            "type": "string",
            "minLength": 20
          },
          "lastUsedAt": {
            "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"
              }
            ]
          },
          "revokedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "revokeReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "entityTimeZone": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "label",
          "prefix",
          "access",
          "scopes",
          "state",
          "standing",
          "daysLeft",
          "createdBy",
          "createdAt",
          "expiresAt",
          "lastUsedAt",
          "revokedBy",
          "revokedAt",
          "revokeReason",
          "entityTimeZone"
        ],
        "additionalProperties": false
      },
      "ListApprovalAuthoritiesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "userId": {
            "type": "string"
          },
          "personName": {
            "type": "string"
          },
          "seatRole": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "ADMIN",
                  "APPROVER",
                  "PREPARER",
                  "VIEWER"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "subjectKind": {
            "type": "string",
            "enum": [
              "BILL",
              "ORDER",
              "RUN"
            ]
          },
          "entityId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entityName": {
            "type": [
              "string",
              "null"
            ]
          },
          "scope": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ANY",
                  "ACCOUNT",
                  "DIMENSION_VALUE",
                  "VENDOR"
                ]
              },
              "id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "label": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "kind",
              "id",
              "label"
            ],
            "additionalProperties": false
          },
          "currency": {
            "type": "string"
          },
          "capMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "ownWorkCapMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "origin": {
            "type": "string",
            "enum": [
              "CARRIED_OVER",
              "PERSON",
              "IMPORT"
            ]
          },
          "setBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "setAlone": {
            "type": "boolean"
          },
          "sourceImport": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "fileName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "fileName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "effectiveFrom": {
            "type": "string",
            "minLength": 20
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "lastDay": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "effectiveTo": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "closedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "closeReason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "CHANGED",
                  "WITHDRAWN"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "closeNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "supersedesId": {
            "type": [
              "string",
              "null"
            ]
          },
          "supersededById": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "IN_FORCE",
              "ENDING",
              "EXPIRED",
              "CLOSED",
              "SEAT_ENDED",
              "EARLIER_SEAT"
            ]
          },
          "entityTimeZone": {
            "type": "string"
          },
          "firingCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "lastFiredAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "userId",
          "personName",
          "seatRole",
          "subjectKind",
          "entityId",
          "entityName",
          "scope",
          "currency",
          "capMinor",
          "ownWorkCapMinor",
          "origin",
          "setBy",
          "setAlone",
          "sourceImport",
          "note",
          "effectiveFrom",
          "expiresAt",
          "lastDay",
          "effectiveTo",
          "closedBy",
          "closeReason",
          "closeNote",
          "supersedesId",
          "supersededById",
          "state",
          "entityTimeZone",
          "firingCount",
          "lastFiredAt"
        ],
        "additionalProperties": false
      },
      "ListApprovalSubstitutesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "person": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "substitute": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "startsOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "endsOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "ended": {
            "$ref": "#/components/schemas/Retired"
          },
          "state": {
            "type": "string",
            "enum": [
              "UPCOMING",
              "LIVE",
              "PAST",
              "ENDED"
            ]
          },
          "entityTimeZone": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "person",
          "substitute",
          "startsOn",
          "endsOn",
          "note",
          "createdBy",
          "createdAt",
          "ended",
          "state",
          "entityTimeZone"
        ],
        "additionalProperties": false
      },
      "ListBankAccountsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "glAccount": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "code",
              "name"
            ],
            "additionalProperties": false
          },
          "originator": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "financialAccountId": {
                    "type": "string"
                  },
                  "originatorId": {
                    "type": "string"
                  },
                  "shortName": {
                    "type": "string"
                  },
                  "longName": {
                    "type": "string"
                  },
                  "destinationDataCentre": {
                    "type": "string"
                  },
                  "nextFileCreationNumber": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9999
                  },
                  "configuredBy": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "updatedAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "verification": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "changeId": {
                            "type": "string"
                          },
                          "verifiedBy": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "verifiedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "method": {
                            "type": "string",
                            "enum": [
                              "CALLBACK_KNOWN_NUMBER",
                              "IN_PERSON",
                              "OTHER"
                            ]
                          }
                        },
                        "required": [
                          "changeId",
                          "verifiedBy",
                          "verifiedAt",
                          "method"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "pendingChange": {
                    "$ref": "#/components/schemas/PendingChange"
                  }
                },
                "required": [
                  "id",
                  "financialAccountId",
                  "originatorId",
                  "shortName",
                  "longName",
                  "destinationDataCentre",
                  "nextFileCreationNumber",
                  "configuredBy",
                  "updatedAt",
                  "verification",
                  "pendingChange"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "pendingChange": {
            "$ref": "#/components/schemas/PendingChange"
          },
          "kind": {
            "type": "string",
            "enum": [
              "BANK",
              "CARD",
              "STRIPE"
            ]
          },
          "connection": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  },
                  "provider": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "displayName",
                  "provider"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "stripeAccountId": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "displayName",
          "currency",
          "glAccount",
          "originator",
          "pendingChange",
          "kind"
        ],
        "additionalProperties": false
      },
      "ListBankFileTestsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "paymentRunId": {
            "type": "string"
          },
          "bankProfileId": {
            "type": "string"
          },
          "profileRevision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "current": {
            "type": "boolean"
          },
          "fileName": {
            "type": "string"
          },
          "fileCreationNumber": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9999
          },
          "consumedFileNumber": {
            "type": "boolean"
          },
          "fileSha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "sizeBytes": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "creditCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "creditTotalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "markedAsTest": {
            "type": "boolean"
          },
          "checkVersion": {
            "type": "string"
          },
          "createdBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "answer": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "verdict": {
                    "type": "string",
                    "enum": [
                      "ACCEPTED",
                      "REJECTED"
                    ]
                  },
                  "recordedBy": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "recordedAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "portalReference": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "rejectedFields": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Field"
                    }
                  },
                  "evidence": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "fileName": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "documentId",
                          "fileName"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "portalText": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "draft": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "promptVersion": {
                            "type": "string"
                          },
                          "proposedOutcome": {
                            "type": "string",
                            "enum": [
                              "ACCEPTED",
                              "REJECTED",
                              "UNCLEAR"
                            ]
                          },
                          "agreed": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "promptVersion",
                          "proposedOutcome",
                          "agreed"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "verdict",
                  "recordedBy",
                  "recordedAt",
                  "portalReference",
                  "note",
                  "rejectedFields",
                  "evidence",
                  "portalText",
                  "draft"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "entityTimeZone": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "paymentRunId",
          "bankProfileId",
          "profileRevision",
          "current",
          "fileName",
          "fileCreationNumber",
          "consumedFileNumber",
          "fileSha256",
          "sizeBytes",
          "creditCount",
          "creditTotalMinor",
          "markedAsTest",
          "checkVersion",
          "createdBy",
          "createdAt",
          "answer",
          "entityTimeZone"
        ],
        "additionalProperties": false
      },
      "ListBankProfilesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "bankName": {
            "type": "string"
          },
          "guide": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "edition": {
                "type": "string"
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "title",
              "edition",
              "url"
            ],
            "additionalProperties": false
          },
          "conventions": {
            "type": "object",
            "properties": {
              "lineEnding": {
                "type": "string",
                "enum": [
                  "CRLF",
                  "LF",
                  "NONE"
                ]
              },
              "lineEndingPage": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "maxDaysAhead": {
                "type": "integer",
                "minimum": 1,
                "maximum": 14
              },
              "maxDaysAheadPage": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "acceptsUsd": {
                "type": "boolean"
              },
              "acceptsUsdPage": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "testMarker": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "testMarkerPage": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "testConsumesFileNumber": {
                "type": "boolean"
              },
              "testConsumesFileNumberPage": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "lineEnding",
              "lineEndingPage",
              "maxDaysAhead",
              "maxDaysAheadPage",
              "acceptsUsd",
              "acceptsUsdPage",
              "testMarker",
              "testMarkerPage",
              "testConsumesFileNumber",
              "testConsumesFileNumberPage"
            ],
            "additionalProperties": false
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "proof": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "NO_PROFILE",
                  "NOT_TESTED",
                  "AWAITING_ANSWER",
                  "REFUSED",
                  "ACCEPTED"
                ]
              },
              "profile": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "bankName": {
                        "type": "string"
                      },
                      "revision": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "id",
                      "bankName",
                      "revision"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "acceptance": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "testId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "provedByRunId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "fileCreationNumber": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "recordedBy": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      "recordedAt": {
                        "type": "string",
                        "minLength": 20
                      },
                      "portalReference": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "testId",
                      "provedByRunId",
                      "fileCreationNumber",
                      "recordedBy",
                      "recordedAt",
                      "portalReference"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "lastTest": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "testId": {
                        "type": "string"
                      },
                      "fileCreationNumber": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "createdAt": {
                        "type": "string",
                        "minLength": 20
                      },
                      "verdict": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "ACCEPTED",
                              "REJECTED"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "testId",
                      "fileCreationNumber",
                      "createdAt",
                      "verdict"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "earlierAcceptance": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "revision": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "recordedAt": {
                        "type": "string",
                        "minLength": 20
                      }
                    },
                    "required": [
                      "revision",
                      "recordedAt"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "state",
              "profile",
              "acceptance",
              "lastTest",
              "earlierAcceptance"
            ],
            "additionalProperties": false
          },
          "accounts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "financialAccountId": {
                  "type": "string"
                },
                "displayName": {
                  "type": "string"
                },
                "entityName": {
                  "type": "string"
                }
              },
              "required": [
                "financialAccountId",
                "displayName",
                "entityName"
              ],
              "additionalProperties": false
            }
          },
          "createdBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "updatedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "updatedAt": {
            "type": "string",
            "minLength": 20
          },
          "entityTimeZone": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "bankName",
          "guide",
          "conventions",
          "revision",
          "proof",
          "accounts",
          "createdBy",
          "createdAt",
          "updatedBy",
          "updatedAt",
          "entityTimeZone"
        ],
        "additionalProperties": false
      },
      "ListBankingIntakeDocumentsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "mimeType": {
            "type": "string"
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "attachedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "attachedAt": {
            "type": "string",
            "minLength": 20
          },
          "usedByLines": {
            "type": "array",
            "items": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          }
        },
        "required": [
          "id",
          "documentId",
          "fileName",
          "mimeType",
          "sizeBytes",
          "attachedBy",
          "attachedAt",
          "usedByLines"
        ],
        "additionalProperties": false
      },
      "ListBillFeedCandidatesResponse": {
        "type": "object",
        "properties": {
          "entityTimeZone": {
            "type": "string"
          },
          "bill": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "openMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "paidBy": {
                "type": "string",
                "enum": [
                  "RUN",
                  "CARD",
                  "PAD",
                  "ACCOUNT",
                  "CHEQUE",
                  "WIRE",
                  "ETRANSFER",
                  "OTHER"
                ]
              },
              "anchorDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "status": {
                "default": "APPROVED",
                "type": "string",
                "enum": [
                  "DRAFT",
                  "IN_REVIEW",
                  "APPROVED",
                  "PARTIALLY_PAID",
                  "PAID",
                  "VOID"
                ]
              },
              "receipt": {
                "default": false,
                "type": "boolean"
              }
            },
            "required": [
              "id",
              "openMinor",
              "currency",
              "paidBy",
              "anchorDate",
              "status",
              "receipt"
            ],
            "additionalProperties": false
          },
          "window": {
            "$ref": "#/components/schemas/Period2"
          },
          "candidates": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sourceTransactionId": {
                  "type": "string"
                },
                "account": {
                  "$ref": "#/components/schemas/Account2"
                },
                "txnDate": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "description": {
                  "type": "string"
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "currency": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$"
                },
                "scoreBp": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 10000
                },
                "linesMatching": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "billsMatching": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "counterparty": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "signals": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "AMOUNT_EXACT",
                          "DATE_WINDOW",
                          "COUNTERPARTY",
                          "REFERENCE",
                          "HISTORY"
                        ]
                      },
                      "scoreBp": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "weightBp": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "phrase": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "kind",
                      "scoreBp",
                      "weightBp",
                      "phrase"
                    ],
                    "additionalProperties": false
                  }
                },
                "evidence": {
                  "type": "string"
                },
                "reading": {
                  "$ref": "#/components/schemas/Reading"
                },
                "record": {
                  "type": "object",
                  "properties": {
                    "method": {
                      "type": "string",
                      "enum": [
                        "CARD",
                        "PAD",
                        "CHEQUE",
                        "WIRE",
                        "ETRANSFER",
                        "OTHER"
                      ]
                    },
                    "settledOn": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "financialAccountId": {
                      "type": "string"
                    },
                    "amountMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "reference": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 60
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "sourceTransactionId": {
                      "type": "string"
                    },
                    "feedScoreBp": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "method",
                    "settledOn",
                    "financialAccountId",
                    "amountMinor",
                    "reference",
                    "sourceTransactionId",
                    "feedScoreBp"
                  ],
                  "additionalProperties": false
                },
                "blocked": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "sourceTransactionId",
                "account",
                "txnDate",
                "description",
                "amountMinor",
                "currency",
                "scoreBp",
                "linesMatching",
                "billsMatching",
                "counterparty",
                "signals",
                "evidence",
                "reading",
                "record",
                "blocked"
              ],
              "additionalProperties": false
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "truncated": {
            "type": "boolean"
          },
          "declined": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sourceTransactionId": {
                  "type": "string"
                },
                "txnDate": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "description": {
                  "type": "string"
                },
                "reason": {
                  "type": "string",
                  "enum": [
                    "NOT_THIS_SUPPLIER",
                    "NOT_THIS_BILL",
                    "NOT_A_PAYMENT",
                    "OTHER"
                  ]
                },
                "by": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name"
                  ],
                  "additionalProperties": false
                },
                "at": {
                  "type": "string",
                  "minLength": 20
                }
              },
              "required": [
                "sourceTransactionId",
                "txnDate",
                "description",
                "reason",
                "by",
                "at"
              ],
              "additionalProperties": false
            }
          },
          "declinedTotal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "otherCurrencyLines": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "entityTimeZone",
          "bill",
          "window",
          "candidates",
          "total",
          "truncated",
          "declined",
          "declinedTotal",
          "otherCurrencyLines"
        ],
        "additionalProperties": false
      },
      "ListBillSettlementsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "billId": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "enum": [
              "RUN",
              "CARD",
              "PAD",
              "ACCOUNT",
              "CHEQUE",
              "WIRE",
              "ETRANSFER",
              "OTHER"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "POSTED",
              "AWAITING_APPROVAL",
              "DECLINED",
              "VOIDED",
              "REVERSED_WITH_RUN"
            ]
          },
          "settledOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "postingDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "amountMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "paidAmountMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "paidCurrency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "functionalAmountMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "functionalCurrency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "account": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "BANK",
                  "CARD",
                  "STRIPE"
                ]
              }
            },
            "required": [
              "id",
              "displayName",
              "kind"
            ],
            "additionalProperties": false
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "run": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "paymentId": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "paymentId"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "entry": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "PROPOSED",
                      "IN_REVIEW",
                      "APPROVED",
                      "POSTED",
                      "DECLINED",
                      "REVERSED"
                    ]
                  }
                },
                "required": [
                  "id",
                  "number",
                  "status"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "recordedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "recordedAt": {
            "type": "string",
            "minLength": 20
          },
          "requiresSecondPerson": {
            "type": "boolean"
          },
          "recorderCapMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "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"
              }
            ]
          },
          "voided": {
            "$ref": "#/components/schemas/Voided"
          },
          "hint": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "method": {
                    "type": "string"
                  },
                  "settledOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "promptVersion": {
                    "type": "string"
                  }
                },
                "required": [
                  "method",
                  "settledOn",
                  "promptVersion"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "approveBlocked": {
            "type": [
              "string",
              "null"
            ]
          },
          "shortReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "deductions": {
            "$ref": "#/components/schemas/Deductions"
          },
          "feedLine": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "sourceTransactionId": {
                    "type": "string"
                  },
                  "txnDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "description": {
                    "type": "string"
                  },
                  "account": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "displayName": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "displayName"
                    ],
                    "additionalProperties": false
                  },
                  "matched": {
                    "type": "boolean"
                  },
                  "scoreBp": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "evidenceReadable": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "sourceTransactionId",
                  "txnDate",
                  "description",
                  "account",
                  "matched",
                  "scoreBp",
                  "evidenceReadable"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "billId",
          "entityId",
          "entityTimeZone",
          "method",
          "state",
          "settledOn",
          "postingDate",
          "amountMinor",
          "currency",
          "paidAmountMinor",
          "paidCurrency",
          "functionalAmountMinor",
          "functionalCurrency",
          "account",
          "reference",
          "note",
          "run",
          "entry",
          "recordedBy",
          "recordedAt",
          "requiresSecondPerson",
          "recorderCapMinor",
          "approvedBy",
          "approvedAt",
          "voided",
          "hint",
          "approveBlocked",
          "shortReason",
          "deductions",
          "feedLine"
        ],
        "additionalProperties": false
      },
      "ListBillSupplierMatchesResponse": {
        "type": "object",
        "properties": {
          "applied": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppliedOption1"
              },
              {
                "type": "null"
              }
            ]
          },
          "proposals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppliedOption1"
            }
          },
          "declinedCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "linkable": {
            "type": "boolean"
          },
          "entityTimeZone": {
            "type": "string"
          }
        },
        "required": [
          "applied",
          "proposals",
          "declinedCount",
          "linkable",
          "entityTimeZone"
        ],
        "additionalProperties": false
      },
      "ListBillsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "supplierName": {
            "type": "string"
          },
          "vendor": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "displayName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "number": {
            "type": [
              "string",
              "null"
            ]
          },
          "billDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "postingDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "dueDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "overdueDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "totalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "openMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "taxMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "IN_REVIEW",
              "DECLINED",
              "APPROVED",
              "HELD",
              "OPEN",
              "DUE",
              "OVERDUE",
              "IN_RUN",
              "PARTIALLY_PAID",
              "PAID",
              "VOID"
            ]
          },
          "memo": {
            "type": [
              "string",
              "null"
            ]
          },
          "run": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "DRAFT",
                      "RELEASED",
                      "CANCELLED"
                    ]
                  },
                  "paymentDate": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "id",
                  "status",
                  "paymentDate"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "hold": {
            "$ref": "#/components/schemas/Hold"
          },
          "paidBy": {
            "type": "string",
            "enum": [
              "RUN",
              "CARD",
              "PAD",
              "ACCOUNT",
              "CHEQUE",
              "WIRE",
              "ETRANSFER",
              "OTHER"
            ]
          },
          "conversion": {
            "$ref": "#/components/schemas/Conversion"
          },
          "supersedesBillId": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "customFields": {
            "$ref": "#/components/schemas/CustomFields2"
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "entityTimeZone",
          "supplierName",
          "vendor",
          "number",
          "billDate",
          "postingDate",
          "dueDate",
          "overdueDays",
          "currency",
          "totalMinor",
          "openMinor",
          "taxMinor",
          "status",
          "memo",
          "run",
          "hold",
          "paidBy",
          "conversion",
          "supersedesBillId"
        ],
        "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
      },
      "ListCustomObjectTypesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "singularLabel": {
            "type": "string"
          },
          "pluralLabel": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "numberPrefix": {
            "type": [
              "string",
              "null"
            ]
          },
          "position": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "liveFieldCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "recordCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "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"
              }
            ]
          },
          "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",
          "key",
          "singularLabel",
          "pluralLabel",
          "description",
          "numberPrefix",
          "position",
          "liveFieldCount",
          "recordCount",
          "archivedAt",
          "archivedBy",
          "createdBy",
          "createdAt",
          "updatedBy",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ListCustomRecordsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "objectKey": {
            "type": "string"
          },
          "number": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "displayNumber": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "values": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            }
          },
          "revision": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "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"
              }
            ]
          },
          "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",
          "objectKey",
          "number",
          "displayNumber",
          "name",
          "values",
          "revision",
          "archivedAt",
          "archivedBy",
          "createdBy",
          "createdAt",
          "updatedBy",
          "updatedAt"
        ],
        "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
      },
      "ListEntitiesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "functionalCurrency": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "region": {
            "type": [
              "string",
              "null"
            ]
          },
          "fiscalYearEndMonth": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12
          },
          "timeZone": {
            "type": "string"
          },
          "incorporatedOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "legalForm": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "CORPORATION",
                  "SOLE_PROPRIETORSHIP",
                  "PARTNERSHIP",
                  "TRUST"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "exchangeDifferenceAccountId": {
            "type": [
              "string",
              "null"
            ]
          },
          "customerDepositsAccountId": {
            "type": [
              "string",
              "null"
            ]
          },
          "holdbackReceivableAccountId": {
            "type": [
              "string",
              "null"
            ]
          },
          "receivableAccountId": {
            "type": [
              "string",
              "null"
            ]
          },
          "defaultSalesAccountId": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoiceTerms": {
            "type": [
              "string",
              "null"
            ]
          },
          "invoiceTermsFr": {
            "type": [
              "string",
              "null"
            ]
          },
          "paymentInstructionsFr": {
            "type": [
              "string",
              "null"
            ]
          },
          "paymentLinkTemplate": {
            "type": [
              "string",
              "null"
            ]
          },
          "goLiveDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "cutoverId": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "name",
          "functionalCurrency",
          "country",
          "region",
          "fiscalYearEndMonth",
          "timeZone",
          "incorporatedOn",
          "legalForm",
          "exchangeDifferenceAccountId",
          "customerDepositsAccountId"
        ],
        "additionalProperties": false
      },
      "ListEventsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "starts_with",
            "pattern": "^evt_.*"
          },
          "type": {
            "$ref": "#/components/schemas/Type"
          },
          "timestamp": {
            "type": "string",
            "minLength": 20
          },
          "apiVersion": {
            "type": "string",
            "const": "v1"
          },
          "ledgerId": {
            "type": "string",
            "minLength": 1
          },
          "position": {
            "type": "string",
            "pattern": "^(0|[1-9]\\d{0,18})$"
          },
          "data": {
            "type": "object",
            "properties": {
              "object": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "minLength": 1
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "additionalProperties": false
              },
              "href": {
                "type": "string",
                "format": "starts_with",
                "pattern": "^\\/v1\\/.*"
              }
            },
            "required": [
              "object",
              "href"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "type",
          "timestamp",
          "apiVersion",
          "ledgerId",
          "position",
          "data"
        ],
        "additionalProperties": false
      },
      "ListEvidenceResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "documentId": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "contentType": {
            "type": "string"
          },
          "byteSize": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "addedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "addedAt": {
            "type": "string",
            "minLength": 20
          },
          "retainUntil": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "detached": {
            "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"
                  }
                },
                "required": [
                  "at",
                  "by",
                  "reason"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "documentId",
          "fileName",
          "contentType",
          "byteSize",
          "note",
          "addedBy",
          "addedAt",
          "retainUntil",
          "detached"
        ],
        "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
      },
      "ListFxRatesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "rateDate": {
            "type": "string"
          },
          "base": {
            "type": "string"
          },
          "quote": {
            "type": "string"
          },
          "rate": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "BOC",
              "MANUAL",
              "PROVIDER"
            ]
          },
          "overrideReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "enteredByName": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "rateDate",
          "base",
          "quote",
          "rate",
          "source",
          "overrideReason",
          "enteredByName"
        ],
        "additionalProperties": false
      },
      "ListHeldOutboundResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "mail",
              "payment-rail",
              "payment-collect",
              "bank-file",
              "cra-filing",
              "provider-config",
              "books-export",
              "webhook",
              "warehouse"
            ]
          },
          "sender": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "recipients": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "attachments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "sizeBytes": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "name",
                "sizeBytes"
              ],
              "additionalProperties": false
            }
          },
          "text": {
            "type": "string",
            "maxLength": 2000
          },
          "truncated": {
            "type": "boolean"
          },
          "heldAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "kind",
          "sender",
          "subject",
          "recipients",
          "attachments",
          "text",
          "truncated",
          "heldAt"
        ],
        "additionalProperties": false
      },
      "ListImportedHistoryResponse": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Record"
        }
      },
      "ListInboundAddressesResponseItem": {
        "type": "object",
        "properties": {
          "domain": {
            "$ref": "#/components/schemas/Domain"
          },
          "id": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "mailbox": {
            "type": "string",
            "enum": [
              "BILLS",
              "INVOICES"
            ]
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "REVOKED"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "createdByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "revokedByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "revokeReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "messageCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "lastMessageAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "vendorId": {
            "type": [
              "string",
              "null"
            ]
          },
          "vendorName": {
            "type": [
              "string",
              "null"
            ]
          },
          "vendorStatus": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "ACTIVE",
                  "ARCHIVED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "purpose": {
            "type": [
              "string",
              "null"
            ]
          },
          "watcherUserId": {
            "type": "string"
          },
          "watcherName": {
            "type": "string"
          },
          "watcherSeat": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "ADMIN",
                  "APPROVER",
                  "PREPARER"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "contact": {
            "$ref": "#/components/schemas/Contact"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "senders": {
            "$ref": "#/components/schemas/Senders"
          },
          "senderDomainCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "replies": {
            "$ref": "#/components/schemas/Replies"
          },
          "reasonSharedWithSenders": {
            "type": "boolean"
          },
          "closing": {
            "$ref": "#/components/schemas/Closing"
          },
          "heldOpen": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "domain",
          "id",
          "address",
          "label",
          "mailbox",
          "entityId",
          "entityName",
          "status",
          "createdAt",
          "createdByName",
          "revokedAt",
          "revokedByName",
          "revokeReason",
          "messageCount",
          "lastMessageAt",
          "vendorId",
          "vendorName",
          "vendorStatus",
          "purpose",
          "watcherUserId",
          "watcherName",
          "watcherSeat",
          "contact",
          "entityTimeZone",
          "senders",
          "senderDomainCount",
          "replies",
          "reasonSharedWithSenders",
          "closing",
          "heldOpen"
        ],
        "additionalProperties": false
      },
      "ListInboundDomainsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "zone": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "VERIFIED",
              "DEGRADED",
              "REMOVED"
            ]
          },
          "records": {
            "minItems": 2,
            "maxItems": 2,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "MX",
                    "TXT"
                  ]
                },
                "host": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                },
                "priority": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "FOUND",
                    "MISSING",
                    "DIFFERENT",
                    "BLOCKED"
                  ]
                },
                "found": {
                  "maxItems": 5,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 200
                  }
                }
              },
              "required": [
                "kind",
                "host",
                "label",
                "value",
                "priority",
                "state",
                "found"
              ],
              "additionalProperties": false
            }
          },
          "findings": {
            "maxItems": 6,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "NO_MX",
                "MX_ELSEWHERE",
                "CNAME_AT_NAME",
                "NO_PROOF",
                "PROOF_WRONG",
                "DOUBLED_SUFFIX",
                "PROVISION_FAILED"
              ]
            }
          },
          "dnsHost": {
            "type": "object",
            "properties": {
              "key": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "label": {
                "type": "string"
              },
              "wantsBareLabel": {
                "type": "boolean"
              },
              "where": {
                "type": "string"
              }
            },
            "required": [
              "key",
              "label",
              "wantsBareLabel",
              "where"
            ],
            "additionalProperties": false
          },
          "verifiedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "lastCheckedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "degradedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "createdBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "removed": {
            "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"
                  },
                  "expired": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "at",
                  "by",
                  "reason",
                  "expired"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "liveAddresses": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "lastError": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "domain",
          "zone",
          "status",
          "records",
          "findings",
          "dnsHost",
          "verifiedAt",
          "lastCheckedAt",
          "degradedAt",
          "createdAt",
          "createdBy",
          "expiresAt",
          "removed",
          "liveAddresses",
          "lastError"
        ],
        "additionalProperties": false
      },
      "ListInboxReplyStopsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "recipientEmail": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "stoppedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "stoppedAt": {
            "type": "string",
            "minLength": 20
          },
          "lifted": {
            "$ref": "#/components/schemas/Retired"
          },
          "entityTimeZone": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "recipientEmail",
          "reason",
          "stoppedBy",
          "stoppedAt",
          "lifted",
          "entityTimeZone"
        ],
        "additionalProperties": false
      },
      "ListIntakeLinksResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "LIVE",
              "FULL",
              "EXPIRED",
              "REVOKED"
            ]
          },
          "createdBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "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"
            ]
          },
          "acceptedToday": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "acceptedTotal": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lastSubmittedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "label",
          "state",
          "createdBy",
          "createdAt",
          "expiresAt",
          "revokedAt",
          "revokedBy",
          "revokeReason",
          "acceptedToday",
          "acceptedTotal",
          "lastSubmittedAt"
        ],
        "additionalProperties": false
      },
      "ListItcWindowDeclarationsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "registrationId": {
            "type": "string"
          },
          "fiscalYearEnd": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "years": {
            "anyOf": [
              {
                "type": "number",
                "const": 2
              },
              {
                "type": "number",
                "const": 4
              }
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "LISTED_FINANCIAL_INSTITUTION",
              "THRESHOLD_OVER_6M",
              "NOT_APPLICABLE"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "declaredBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "registrationId",
          "fiscalYearEnd",
          "years",
          "reason",
          "note",
          "declaredBy",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "ListMcpExecutionsResponseItem": {
        "type": "object",
        "properties": {
          "executionId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "codeSha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "COMPLETED",
              "FAILED",
              "HALTED_FOR_CONFIRMATION",
              "LIMIT_EXCEEDED"
            ]
          },
          "startedAt": {
            "type": "string",
            "minLength": 20
          },
          "endedAt": {
            "type": "string",
            "minLength": 20
          },
          "calls": {
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "operation": {
                  "type": "string"
                },
                "status": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "recordIds": {
                  "maxItems": 50,
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "confirmationId": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "operation",
                "status",
                "recordIds",
                "confirmationId"
              ],
              "additionalProperties": false
            }
          },
          "ledgerId": {
            "type": "string"
          },
          "appName": {
            "type": "string"
          },
          "personName": {
            "type": "string"
          },
          "callCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "code": {
            "type": "string"
          }
        },
        "required": [
          "executionId",
          "codeSha256",
          "outcome",
          "startedAt",
          "endedAt",
          "calls",
          "ledgerId",
          "appName",
          "personName",
          "callCount",
          "code"
        ],
        "additionalProperties": false
      },
      "ListMigrationFindingsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "readingId": {
            "type": "string"
          },
          "lineNo": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "cause": {
            "$ref": "#/components/schemas/Cause"
          },
          "severity": {
            "type": "string",
            "enum": [
              "NEEDS_LOOK",
              "FYI"
            ]
          },
          "basis": {
            "type": "string",
            "enum": [
              "RULE",
              "MODEL"
            ]
          },
          "subject": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "vendorId": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "key",
              "label",
              "vendorId"
            ],
            "additionalProperties": false
          },
          "other": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "vendorId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "key",
                  "label",
                  "vendorId"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "leftMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "rightMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "differenceMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "explanation": {
            "type": "string"
          },
          "evidence": {
            "type": "object",
            "properties": {
              "rows": {
                "maxItems": 25,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "line": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "balanceMinor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "asReadMinor": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "line",
                    "number",
                    "balanceMinor",
                    "asReadMinor",
                    "why"
                  ],
                  "additionalProperties": false
                }
              },
              "rowsTotal": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "files": {
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "importId": {
                      "type": "string"
                    },
                    "fileName": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "importId",
                    "fileName"
                  ],
                  "additionalProperties": false
                }
              },
              "candidates": {
                "maxItems": 3,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "enum": [
                        "BOOKS",
                        "FILE"
                      ]
                    },
                    "vendorId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "line": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "source",
                    "vendorId",
                    "name",
                    "line"
                  ],
                  "additionalProperties": false
                }
              },
              "pair": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "theirs": {
                        "type": "string"
                      },
                      "ours": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "theirs",
                      "ours"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "note": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "where": {
                        "type": "string",
                        "enum": [
                          "BILL_MEMO",
                          "SUPPLIER_NOTE"
                        ]
                      },
                      "line": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "reason": {
                        "type": "string",
                        "enum": [
                          "PAID_OR_PART_PAID",
                          "CREDIT_OR_ADJUSTMENT",
                          "DISPUTED_OR_ON_HOLD",
                          "DUPLICATE_OF_ANOTHER",
                          "INACTIVE_OR_CLOSED",
                          "MERGED_OR_RENAMED",
                          "NOTHING_STATED"
                        ]
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "where",
                      "line",
                      "reason",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "month": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "periodLabel": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "periodLabel"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "rows",
              "rowsTotal",
              "files",
              "candidates",
              "pair",
              "note",
              "month"
            ],
            "additionalProperties": false
          },
          "proposal": {
            "type": "boolean"
          },
          "proposedClass": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "TIMING",
                  "CLASSIFICATION",
                  "MISSING_SOURCE",
                  "OUR_DEFECT"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "lineId": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "FACT",
              "WAITING",
              "ACCEPTED",
              "CHANGED",
              "DECLINED",
              "SUPPRESSED",
              "STALE"
            ]
          },
          "decision": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "by": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "at": {
                    "type": "string",
                    "minLength": 20
                  },
                  "finalClass": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "TIMING",
                          "CLASSIFICATION",
                          "MISSING_SOURCE",
                          "OUR_DEFECT"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "finalReason": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "PAID_OR_PART_PAID",
                          "CREDIT_OR_ADJUSTMENT",
                          "DISPUTED_OR_ON_HOLD",
                          "DUPLICATE_OF_ANOTHER",
                          "INACTIVE_OR_CLOSED",
                          "MERGED_OR_RENAMED",
                          "NOTHING_STATED"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "state": {
                    "type": "string",
                    "enum": [
                      "ACCEPTED",
                      "CHANGED",
                      "DECLINED"
                    ]
                  }
                },
                "required": [
                  "by",
                  "at",
                  "finalClass",
                  "finalReason",
                  "note",
                  "state"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "suppressedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "by": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "at": {
                    "type": "string",
                    "minLength": 20
                  },
                  "until": {
                    "type": "string",
                    "minLength": 20
                  }
                },
                "required": [
                  "by",
                  "at",
                  "until"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "staleWhy": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "readingId",
          "lineNo",
          "cause",
          "severity",
          "basis",
          "subject",
          "other",
          "leftMinor",
          "rightMinor",
          "differenceMinor",
          "currency",
          "explanation",
          "evidence",
          "proposal",
          "proposedClass",
          "lineId",
          "state",
          "decision",
          "suppressedBy",
          "staleWhy"
        ],
        "additionalProperties": false
      },
      "ListMigrationReadingsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "cutoverId": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "SUPPLIER_LISTS",
              "OPEN_PAYABLES",
              "BANKING_FILE",
              "FIRST_MONTH"
            ]
          },
          "readAt": {
            "type": "string",
            "minLength": 20
          },
          "readBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "side": {
                  "type": "string",
                  "enum": [
                    "LEFT",
                    "RIGHT"
                  ]
                },
                "importId": {
                  "type": "string"
                },
                "importKind": {
                  "type": "string"
                },
                "fileName": {
                  "type": "string"
                },
                "fileSha256": {
                  "type": "string",
                  "maxLength": 12
                },
                "statusAtRead": {
                  "type": "string"
                },
                "rowsAtRead": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "side",
                "importId",
                "importKind",
                "fileName",
                "fileSha256",
                "statusAtRead",
                "rowsAtRead"
              ],
              "additionalProperties": false
            }
          },
          "typed": {
            "type": "object",
            "properties": {
              "reportTotalMinor": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "trialBalancePayableMinor": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "reportTotalMinor",
              "trialBalancePayableMinor"
            ],
            "additionalProperties": false
          },
          "figures": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "SUPPLIER_LISTS"
                  },
                  "listedRows": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "listedSuppliers": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "owedSuppliers": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "listedNotOwed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "poolTruncated": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "kind",
                  "listedRows",
                  "listedSuppliers",
                  "owedSuppliers",
                  "listedNotOwed",
                  "poolTruncated"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "OPEN_PAYABLES"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "reportTotalMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "fileRowsAsReadMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "readyInForceMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "changedByHandMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "heldMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "creditsMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "remainderMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "unconvertedRows": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "unreadableRows": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "readyRows": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "heldRows": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "creditRows": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "changedRows": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "trialBalancePayableMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "trialBalanceDifferenceMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "postedMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "postedDifferenceMinor": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "kind",
                  "currency",
                  "reportTotalMinor",
                  "fileRowsAsReadMinor",
                  "readyInForceMinor",
                  "changedByHandMinor",
                  "heldMinor",
                  "creditsMinor",
                  "remainderMinor",
                  "unconvertedRows",
                  "unreadableRows",
                  "readyRows",
                  "heldRows",
                  "creditRows",
                  "changedRows",
                  "trialBalancePayableMinor",
                  "trialBalanceDifferenceMinor",
                  "postedMinor",
                  "postedDifferenceMinor"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "BANKING_FILE"
                  },
                  "owedSuppliers": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "verified": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "waiting": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "inFileInReview": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "none": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "unknownRows": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "differing": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "owedSuppliers",
                  "verified",
                  "waiting",
                  "inFileInReview",
                  "none",
                  "unknownRows",
                  "differing"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "FIRST_MONTH"
                  },
                  "periodLabel": {
                    "type": "string"
                  },
                  "linesWithDifference": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "proposed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "linesWithProposals": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "linesLeft": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "periodLabel",
                  "linesWithDifference",
                  "proposed",
                  "linesWithProposals",
                  "linesLeft"
                ],
                "additionalProperties": false
              }
            ]
          },
          "counts": {
            "type": "object",
            "properties": {
              "findings": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "needsLook": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "fyi": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "proposals": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "waiting": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "accepted": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "changed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "declined": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "suppressed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "stale": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "findings",
              "needsLook",
              "fyi",
              "proposals",
              "waiting",
              "accepted",
              "changed",
              "declined",
              "suppressed",
              "stale"
            ],
            "additionalProperties": false
          },
          "latest": {
            "type": "boolean"
          },
          "newerReadingId": {
            "type": [
              "string",
              "null"
            ]
          },
          "assistant": {
            "type": "object",
            "properties": {
              "runs": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "last": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "runs",
              "last"
            ],
            "additionalProperties": false
          },
          "rulesVersion": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "cutoverId",
          "entityId",
          "entityName",
          "entityTimeZone",
          "kind",
          "readAt",
          "readBy",
          "currency",
          "files",
          "typed",
          "figures",
          "counts",
          "latest",
          "newerReadingId",
          "assistant",
          "rulesVersion"
        ],
        "additionalProperties": false
      },
      "ListOperationProposalsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "operation": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "effectClass": {
            "type": "string",
            "enum": [
              "read",
              "write",
              "delete",
              "money-out",
              "banking",
              "cra-filing"
            ]
          },
          "reasoning": {
            "type": "string"
          },
          "proposedBy": {
            "type": "object",
            "properties": {
              "presence": {
                "type": "string",
                "enum": [
                  "person",
                  "connected_session",
                  "background_agent"
                ]
              },
              "label": {
                "type": "string"
              },
              "causationUserName": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "presence",
              "label",
              "causationUserName"
            ],
            "additionalProperties": false
          },
          "entityId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entityName": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "APPROVED",
              "REJECTED",
              "EXPIRED"
            ]
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "expiresAt": {
            "type": "string",
            "minLength": 20
          },
          "decidedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "decidedByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "declineReason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "operation",
          "summary",
          "effectClass",
          "reasoning",
          "proposedBy",
          "entityId",
          "entityName",
          "status",
          "createdAt",
          "expiresAt",
          "decidedAt",
          "decidedByName",
          "declineReason"
        ],
        "additionalProperties": false
      },
      "ListPaymentReturnProposalsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PROPOSED",
              "CONFIRMED",
              "DISMISSED",
              "SUPERSEDED"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "BANK_FILE",
              "RAIL"
            ]
          },
          "returnCode": {
            "type": "string",
            "enum": [
              "R900",
              "R902",
              "R903",
              "R904",
              "R905",
              "R909",
              "R910",
              "R911",
              "R912",
              "R922",
              "R990",
              "OTHER"
            ]
          },
          "returnLabel": {
            "type": "string"
          },
          "returnNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "returnedOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "flagsBanking": {
            "type": "boolean"
          },
          "payment": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "sequence": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              "amountMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "vendor": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "bills": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "number"
                  ],
                  "additionalProperties": false
                }
              },
              "billCount": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "id",
              "sequence",
              "amountMinor",
              "currency",
              "vendor",
              "bills",
              "billCount"
            ],
            "additionalProperties": false
          },
          "run": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "paymentDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "entityId": {
                "type": "string"
              },
              "entityName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "paymentDate",
              "entityId",
              "entityName"
            ],
            "additionalProperties": false
          },
          "file": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "fileName": {
                    "type": "string"
                  },
                  "recordNumber": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "segmentNumber": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 6
                  }
                },
                "required": [
                  "id",
                  "fileName",
                  "recordNumber",
                  "segmentNumber"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "proposedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "proposedAt": {
            "type": "string",
            "minLength": 20
          },
          "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"
              }
            ]
          },
          "decisionNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "earlierDismissal": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "decidedBy": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "decidedAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "note": {
                    "type": "string"
                  }
                },
                "required": [
                  "decidedBy",
                  "decidedAt",
                  "note"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "status",
          "source",
          "returnCode",
          "returnLabel",
          "returnNote",
          "returnedOn",
          "flagsBanking",
          "payment",
          "run",
          "file",
          "proposedBy",
          "proposedAt",
          "decidedBy",
          "decidedAt",
          "decisionNote",
          "earlierDismissal"
        ],
        "additionalProperties": false
      },
      "ListPaymentTermsResponseItem": {
        "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"
            ]
          },
          "discountAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "customerCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "vendorCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "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
          }
        },
        "required": [
          "id",
          "name",
          "netDays",
          "discountBp",
          "discountDays",
          "interestMonthlyBp",
          "interestAnnualBp",
          "isDefault",
          "appliesTo",
          "discountAccount",
          "customerCount",
          "createdBy",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ListPeriodLocksResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "scope": {
            "type": "string",
            "enum": [
              "GLOBAL",
              "ENTITY",
              "SUBLEDGER"
            ]
          },
          "subledger": {
            "type": "string",
            "enum": [
              "GL",
              "AP",
              "AR",
              "BANK",
              "TAX"
            ]
          },
          "entityId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entityName": {
            "type": [
              "string",
              "null"
            ]
          },
          "periodYear": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodMonth": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodLabel": {
            "type": "string"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "lockedByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "lockedAt": {
            "type": "string"
          },
          "unlockedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "unlockedByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "unlockReason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "scope",
          "subledger",
          "entityId",
          "entityName",
          "periodYear",
          "periodMonth",
          "periodLabel",
          "reason",
          "lockedByName",
          "lockedAt",
          "unlockedAt",
          "unlockedByName",
          "unlockReason"
        ],
        "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
      },
      "ListQuestionsResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ListQuestionsResponseItem"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "data",
          "nextCursor",
          "total"
        ],
        "additionalProperties": false
      },
      "ListQuestionsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "about": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ENTRY",
                  "SOURCE_TRANSACTION",
                  "BILL",
                  "INVOICE",
                  "CREDIT_MEMO"
                ]
              },
              "id": {
                "type": "string"
              },
              "date": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "amountMinor": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "currency": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "detail": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "kind",
              "id",
              "date",
              "label",
              "amountMinor",
              "currency",
              "detail"
            ],
            "additionalProperties": false
          },
          "text": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "ANSWERED",
              "RESOLVED"
            ]
          },
          "askedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "askedAt": {
            "type": "string",
            "minLength": 20
          },
          "askedOf": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "answer": {
            "type": [
              "string",
              "null"
            ]
          },
          "answeredBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "answeredAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "resolution": {
            "type": [
              "string",
              "null"
            ]
          },
          "resolvedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "resolvedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "ruleId": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastSentAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "ageDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "canAnswer": {
            "type": "boolean"
          },
          "topic": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "AMOUNT",
                  "SUPPLIER",
                  "CODING",
                  "TAX",
                  "DUPLICATE",
                  "OTHER"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "outcome": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "NO_CHANGE",
                  "APPROVED",
                  "HELD",
                  "SENT_BACK",
                  "EDITED",
                  "SUPPLIER_ASKED",
                  "VOIDED"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "about",
          "text",
          "status",
          "askedBy",
          "askedAt",
          "askedOf",
          "answer",
          "answeredBy",
          "answeredAt",
          "resolution",
          "resolvedBy",
          "resolvedAt",
          "ruleId",
          "lastSentAt",
          "ageDays",
          "canAnswer",
          "topic",
          "outcome"
        ],
        "additionalProperties": false
      },
      "ListReconCertificationsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "financialAccountId": {
            "type": "string"
          },
          "periodYear": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodMonth": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12
          },
          "periodLabel": {
            "type": "string"
          },
          "statementBalanceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "ledgerBalanceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "differenceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "exceptionCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "exceptionTotalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "exceptions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sourceTransactionId": {
                  "type": "string"
                },
                "postedOn": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "description": {
                  "type": "string"
                },
                "carriedAs": {
                  "type": "string",
                  "enum": [
                    "UNMATCHED",
                    "PROPOSED",
                    "MATCHED_TO_REVERSED"
                  ]
                }
              },
              "required": [
                "sourceTransactionId",
                "postedOn",
                "amountMinor",
                "description",
                "carriedAs"
              ],
              "additionalProperties": false
            }
          },
          "exceptionsTruncated": {
            "type": "boolean"
          },
          "excludedCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "excludedTotalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "excludedForeignCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "excludedForeignCurrencies": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "certifiedAt": {
            "type": "string",
            "minLength": 20
          },
          "certifiedBy": {
            "type": "string"
          },
          "withdrawnAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "withdrawnBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "withdrawReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "currentLedgerBalanceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "stale": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "financialAccountId",
          "periodYear",
          "periodMonth",
          "periodLabel",
          "statementBalanceMinor",
          "ledgerBalanceMinor",
          "differenceMinor",
          "exceptionCount",
          "exceptionTotalMinor",
          "exceptions",
          "exceptionsTruncated",
          "excludedCount",
          "excludedTotalMinor",
          "excludedForeignCount",
          "excludedForeignCurrencies",
          "note",
          "certifiedAt",
          "certifiedBy",
          "withdrawnAt",
          "withdrawnBy",
          "withdrawReason",
          "currentLedgerBalanceMinor",
          "stale"
        ],
        "additionalProperties": false
      },
      "ListRecordsDestructionPermissionsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "craReference": {
            "type": "string"
          },
          "grantedOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "covers": {
            "type": "string"
          },
          "vendor": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "displayName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "document": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "fileName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "fileName"
            ],
            "additionalProperties": false
          },
          "recordedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "recordedAt": {
            "type": "string",
            "minLength": 20
          },
          "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"
            ]
          },
          "usedByRequests": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "entityTimeZone": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "craReference",
          "grantedOn",
          "covers",
          "vendor",
          "document",
          "recordedBy",
          "recordedAt",
          "voidedAt",
          "voidedBy",
          "voidReason",
          "usedByRequests",
          "entityTimeZone"
        ],
        "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
      },
      "ListRemittanceChangesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "BANK_DETAILS",
              "HOW_TO_PAY",
              "PAYMENT_LINK"
            ]
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "language": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "en",
                  "fr"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PROPOSED",
              "VERIFIED",
              "REJECTED",
              "WITHDRAWN",
              "EXPIRED"
            ]
          },
          "proposedSummary": {
            "type": "string"
          },
          "currentSummary": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "proposedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "proposedAt": {
            "type": "string",
            "minLength": 20
          },
          "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"
              }
            ]
          },
          "decisionNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiresAt": {
            "type": "string",
            "minLength": 20
          },
          "mayVerify": {
            "type": "boolean"
          },
          "whyNot": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "kind",
          "entityId",
          "entityName",
          "currency",
          "language",
          "status",
          "proposedSummary",
          "currentSummary",
          "note",
          "proposedBy",
          "proposedAt",
          "decidedBy",
          "decidedAt",
          "decisionNote",
          "expiresAt",
          "mayVerify",
          "whyNot"
        ],
        "additionalProperties": false
      },
      "ListRulesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "sourceText": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "ROUTING",
              "CODING",
              "AUTO_APPROVAL",
              "HOLD",
              "MATCH_TOLERANCE",
              "LINE_PROFILE",
              "RUN_PREPARE"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PROPOSED",
              "ACTIVE",
              "DISCARDED",
              "RETIRED"
            ]
          },
          "origin": {
            "type": "string",
            "enum": [
              "WRITTEN",
              "LEARNED"
            ]
          },
          "entityId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entityName": {
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "isAutoApproval": {
            "type": "boolean"
          },
          "rule": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RuleOption1"
              },
              {
                "type": "null"
              }
            ]
          },
          "interpretation": {
            "type": "string"
          },
          "authorName": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "sourceEntryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "sourceEntryRef": {
            "type": [
              "string",
              "null"
            ]
          },
          "supersedesId": {
            "type": [
              "string",
              "null"
            ]
          },
          "firingCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "toleranceUsedMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "toleranceTotalCapMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "vendor": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  },
                  "archived": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "id",
                  "displayName",
                  "archived"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "fillStats": {
            "default": null,
            "anyOf": [
              {
                "$ref": "#/components/schemas/FillStatsOption1"
              },
              {
                "type": "null"
              }
            ]
          },
          "runPolicy": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "financialAccountId": {
                    "type": "string"
                  },
                  "accountName": {
                    "type": "string"
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "EFT",
                      "CHEQUE",
                      "WIRE"
                    ]
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "perBillCapMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "weekCapMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "weekUsedMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "maxBills": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "weekday": {
                    "type": "string",
                    "enum": [
                      "MON",
                      "TUE",
                      "WED",
                      "THU",
                      "FRI",
                      "SAT",
                      "SUN"
                    ]
                  },
                  "payInDays": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "nextPassOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "nextPassState": {
                    "type": "string",
                    "enum": [
                      "SCHEDULED",
                      "PAUSED",
                      "NOT_LIVE"
                    ]
                  },
                  "pausedUntil": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lastPass": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "firedAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "outcome": {
                            "type": "string"
                          },
                          "runId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "firedAt",
                          "outcome",
                          "runId"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "openDeclines": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "replacesRuleId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "entityTimeZone": {
                    "type": "string"
                  }
                },
                "required": [
                  "financialAccountId",
                  "accountName",
                  "method",
                  "currency",
                  "perBillCapMinor",
                  "weekCapMinor",
                  "weekUsedMinor",
                  "maxBills",
                  "weekday",
                  "payInDays",
                  "nextPassOn",
                  "nextPassState",
                  "pausedUntil",
                  "lastPass",
                  "openDeclines",
                  "replacesRuleId",
                  "entityTimeZone"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "lastFiredAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "authorMayApprove": {
            "type": "boolean"
          },
          "subject": {
            "type": "string",
            "enum": [
              "ENTRY",
              "BILL",
              "VENDOR",
              "RUN",
              "INVOICE"
            ]
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "expired": {
            "type": "boolean"
          },
          "desk": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "first": {
                    "$ref": "#/components/schemas/Desk"
                  },
                  "second": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/Desk"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "previewId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "first",
                  "second",
                  "previewId"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "readerIsAuthor": {
            "type": "boolean"
          },
          "holdingNow": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "sourceText",
          "kind",
          "status",
          "origin",
          "entityId",
          "entityName",
          "version",
          "isAutoApproval",
          "rule",
          "interpretation",
          "authorName",
          "createdAt",
          "sourceEntryId",
          "sourceEntryRef",
          "supersedesId",
          "firingCount",
          "toleranceUsedMinor",
          "toleranceTotalCapMinor",
          "vendor",
          "fillStats",
          "runPolicy",
          "lastFiredAt",
          "authorMayApprove",
          "subject",
          "expiresAt",
          "expired",
          "desk",
          "readerIsAuthor",
          "holdingNow"
        ],
        "additionalProperties": false
      },
      "ListSavedQueriesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "MEASURES",
              "SQL"
            ]
          },
          "definition": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "measures": {
                    "minItems": 1,
                    "maxItems": 5,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "groupBy": {
                    "default": [],
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "filters": {
                    "$ref": "#/components/schemas/Filters"
                  },
                  "period": {
                    "$ref": "#/components/schemas/Period2"
                  },
                  "orderBy": {
                    "$ref": "#/components/schemas/OrderBy"
                  },
                  "limit": {
                    "default": 100,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  }
                },
                "required": [
                  "measures",
                  "groupBy",
                  "filters",
                  "orderBy",
                  "limit"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "sql": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 20000
                  }
                },
                "required": [
                  "sql"
                ],
                "additionalProperties": false
              }
            ]
          },
          "shared": {
            "type": "boolean"
          },
          "ownerName": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "updatedAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "kind",
          "definition",
          "shared",
          "ownerName",
          "revision",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ListSchedulesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "frequency": {
            "type": "string",
            "enum": [
              "WEEKLY",
              "BIWEEKLY",
              "MONTHLY",
              "QUARTERLY",
              "ANNUAL"
            ]
          },
          "startDate": {
            "type": "string"
          },
          "endDate": {
            "type": [
              "string",
              "null"
            ]
          },
          "nextRunDate": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "autoReverse": {
            "type": "boolean"
          },
          "reversalOffsetDays": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "approvalMode": {
            "type": "string",
            "enum": [
              "QUEUE",
              "AUTO_APPROVE"
            ]
          },
          "createdByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "producedEntries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "entryRef": {
                  "type": "string"
                },
                "entryDate": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "DRAFT",
                    "PROPOSED",
                    "IN_REVIEW",
                    "APPROVED",
                    "POSTED",
                    "DECLINED",
                    "REVERSED"
                  ]
                }
              },
              "required": [
                "id",
                "entryRef",
                "entryDate",
                "status"
              ],
              "additionalProperties": false
            }
          },
          "producedEntriesTotal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "kind": {
            "type": "string",
            "enum": [
              "ENTRY",
              "BILL"
            ]
          },
          "vendorName": {
            "type": [
              "string",
              "null"
            ]
          },
          "producedBills": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "scheduledFor": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "DRAFT",
                    "IN_REVIEW",
                    "APPROVED",
                    "PARTIALLY_PAID",
                    "PAID",
                    "VOID"
                  ]
                }
              },
              "required": [
                "id",
                "number",
                "scheduledFor",
                "status"
              ],
              "additionalProperties": false
            }
          },
          "producedBillsTotal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "name",
          "entityName",
          "frequency",
          "startDate",
          "endDate",
          "nextRunDate",
          "active",
          "autoReverse",
          "reversalOffsetDays",
          "approvalMode",
          "createdByName",
          "producedEntries",
          "producedEntriesTotal"
        ],
        "additionalProperties": false
      },
      "ListSettlementRegistrationsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "processor": {
            "type": "string",
            "enum": [
              "STRIPE",
              "SHOPIFY",
              "LIGHTSPEED"
            ]
          },
          "connectionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "connectionName": {
            "type": [
              "string",
              "null"
            ]
          },
          "externalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "glAccount": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "code",
              "name"
            ],
            "additionalProperties": false
          },
          "clearingAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "feeAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "revenueAccount": {
            "$ref": "#/components/schemas/Account"
          },
          "bankAccount": {
            "$ref": "#/components/schemas/Account"
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "displayName",
          "currency",
          "processor",
          "connectionId",
          "connectionName",
          "externalId",
          "glAccount",
          "clearingAccount",
          "feeAccount",
          "revenueAccount",
          "bankAccount"
        ],
        "additionalProperties": false
      },
      "ListSpecificProvisionsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "customer": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "displayName"
            ],
            "additionalProperties": false
          },
          "amountMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "currency": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "effectiveFrom": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "effectiveTo": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "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",
          "entityId",
          "customer",
          "amountMinor",
          "currency",
          "reason",
          "effectiveFrom",
          "effectiveTo",
          "createdBy",
          "createdAt",
          "updatedBy",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ListTaxCheckFindingsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "EXPORT_CHARGED",
              "PRODUCT_TREATMENT",
              "PLACE_MISMATCH",
              "RATE_MISMATCH"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "DISMISSED",
              "CLEARED"
            ]
          },
          "invoice": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "number": {
                "type": "string"
              },
              "issueDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "customerId": {
                "type": "string"
              },
              "customerName": {
                "type": "string"
              },
              "currency": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "number",
              "issueDate",
              "customerId",
              "customerName",
              "currency"
            ],
            "additionalProperties": false
          },
          "journalLineId": {
            "type": "string"
          },
          "lineNumber": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "expectedPlace": {
            "type": [
              "string",
              "null"
            ]
          },
          "linePlace": {
            "type": [
              "string",
              "null"
            ]
          },
          "placeBasis": {
            "type": "string",
            "enum": [
              "SNAPSHOT",
              "CUSTOMER"
            ]
          },
          "treatment": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "STANDARD",
                  "ZERO_RATED",
                  "EXEMPT",
                  "OUT_OF_SCOPE",
                  "RELIEVED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "expectedTreatment": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "STANDARD",
                  "ZERO_RATED",
                  "EXEMPT",
                  "OUT_OF_SCOPE",
                  "RELIEVED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "chargedTaxMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "expectedTaxMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "message": {
            "type": "string"
          },
          "firstSeenAt": {
            "type": "string",
            "minLength": 20
          },
          "lastSeenAt": {
            "type": "string",
            "minLength": 20
          },
          "dismissed": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "by": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "at": {
                    "type": "string",
                    "minLength": 20
                  },
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "by",
                  "at",
                  "reason"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "clearedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "kind",
          "status",
          "invoice",
          "journalLineId",
          "lineNumber",
          "expectedPlace",
          "linePlace",
          "placeBasis",
          "treatment",
          "expectedTreatment",
          "chargedTaxMinor",
          "expectedTaxMinor",
          "message",
          "firstSeenAt",
          "lastSeenAt",
          "dismissed",
          "clearedAt"
        ],
        "additionalProperties": false
      },
      "ListValidationRulesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "recordKind": {
            "type": "string",
            "enum": [
              "CUSTOMER",
              "INVOICE",
              "CREDIT_MEMO",
              "PRODUCT",
              "CONTRACT",
              "VENDOR",
              "BILL",
              "PURCHASE_ORDER",
              "JOURNAL_ENTRY",
              "CUSTOM_OBJECT",
              "LINE"
            ]
          },
          "objectKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "lineKind": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "PURCHASE_ORDER_LINE",
                  "GOODS_RECEIPT_LINE",
                  "BILL_LINE",
                  "VENDOR_CREDIT_LINE",
                  "INVOICE_LINE",
                  "CREDIT_MEMO_LINE",
                  "JOURNAL_LINE"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "condition": {
            "$ref": "#/components/schemas/Condition"
          },
          "summary": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "fieldKey": {
            "type": [
              "string",
              "null"
            ]
          },
          "position": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "needsAttention": {
            "type": "boolean"
          },
          "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"
              }
            ]
          },
          "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",
          "recordKind",
          "objectKey",
          "lineKind",
          "name",
          "description",
          "condition",
          "summary",
          "message",
          "fieldKey",
          "position",
          "needsAttention",
          "archivedAt",
          "archivedBy",
          "createdBy",
          "createdAt",
          "updatedBy",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ListVendorAgreementsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "vendorId": {
            "type": "string"
          },
          "entity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "name": {
            "type": "string"
          },
          "startsOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "endsOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "renewal": {
            "type": "string",
            "enum": [
              "AUTO_RENEWS",
              "ENDS",
              "OPEN_ENDED"
            ]
          },
          "noticeDays": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "actBy": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "daysToAct": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "committed": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CommittedOption1"
              },
              {
                "type": "null"
              }
            ]
          },
          "account": {
            "$ref": "#/components/schemas/Account"
          },
          "signedCopy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string"
                  },
                  "fileName": {
                    "type": "string"
                  },
                  "openable": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "documentId",
                  "fileName",
                  "openable"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "owner": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "UPCOMING",
              "ACTIVE",
              "ACT_SOON",
              "ACT_BY_PASSED",
              "TERM_PASSED",
              "RENEWED",
              "ENDED"
            ]
          },
          "decision": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "RENEW",
                      "LET_END"
                    ]
                  },
                  "by": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "at": {
                    "type": "string",
                    "minLength": 20
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "decision",
                  "by",
                  "at",
                  "note"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "ended": {
            "$ref": "#/components/schemas/Retired"
          },
          "renews": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "endsOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "endsOn"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "renewedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "startsOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  }
                },
                "required": [
                  "id",
                  "startsOn"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "notice": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "NONE",
                  "DRAFTED",
                  "SENT"
                ]
              },
              "noticeId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "by": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "on": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "state",
              "noticeId",
              "by",
              "on"
            ],
            "additionalProperties": false
          },
          "entityTimeZone": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "vendorId",
          "entity",
          "name",
          "startsOn",
          "endsOn",
          "renewal",
          "noticeDays",
          "actBy",
          "daysToAct",
          "committed",
          "account",
          "signedCopy",
          "owner",
          "note",
          "state",
          "decision",
          "ended",
          "renews",
          "renewedBy",
          "notice",
          "entityTimeZone"
        ],
        "additionalProperties": false
      },
      "ListVendorAliasesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "vendorId": {
            "type": "string"
          },
          "alias": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "RENAME",
              "MERGE",
              "FROM_BILL",
              "ACCEPTED_MATCH",
              "TYPED"
            ]
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "createdBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "bill": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "number"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "merge": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "vendorId",
          "alias",
          "source",
          "createdAt",
          "createdBy",
          "bill",
          "merge"
        ],
        "additionalProperties": false
      },
      "ListVendorCreditRefundsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "vendorCreditId": {
            "type": "string"
          },
          "vendorId": {
            "type": [
              "string",
              "null"
            ]
          },
          "receivedOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "postingDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "amountMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "receivedAmountMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "receivedCurrency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "functionalAmountMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "account": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "displayName"
            ],
            "additionalProperties": false
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "sourceTransactionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entry": {
            "$ref": "#/components/schemas/Entry"
          },
          "recordedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "recordedAt": {
            "type": "string",
            "minLength": 20
          },
          "requiresSecondPerson": {
            "type": "boolean"
          },
          "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"
              }
            ]
          },
          "voided": {
            "$ref": "#/components/schemas/Voided"
          },
          "state": {
            "type": "string",
            "enum": [
              "AWAITING",
              "POSTED",
              "VOIDED"
            ]
          },
          "approveBlocked": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "vendorCreditId",
          "vendorId",
          "receivedOn",
          "postingDate",
          "amountMinor",
          "currency",
          "receivedAmountMinor",
          "receivedCurrency",
          "functionalAmountMinor",
          "account",
          "reference",
          "note",
          "sourceTransactionId",
          "entry",
          "recordedBy",
          "recordedAt",
          "requiresSecondPerson",
          "approvedBy",
          "approvedAt",
          "voided",
          "state",
          "approveBlocked"
        ],
        "additionalProperties": false
      },
      "ListVendorDocumentsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "vendorId": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "WSIB_CLEARANCE",
              "INSURANCE_CERTIFICATE",
              "MASTER_AGREEMENT",
              "W8BEN",
              "DIRECT_DEPOSIT_FORM",
              "WITHHOLDING_WAIVER",
              "OTHER"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "validFrom": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "validUntil": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "CURRENT",
              "EXPIRING",
              "EXPIRED",
              "NOT_YET",
              "SUPERSEDED",
              "WITHDRAWN"
            ]
          },
          "daysToExpiry": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "file": {
            "type": "object",
            "properties": {
              "documentId": {
                "type": "string"
              },
              "fileName": {
                "type": "string"
              },
              "mimeType": {
                "type": "string"
              },
              "sizeBytes": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "openable": {
                "type": "boolean"
              }
            },
            "required": [
              "documentId",
              "fileName",
              "mimeType",
              "sizeBytes",
              "openable"
            ],
            "additionalProperties": false
          },
          "recordedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "recordedAt": {
            "type": "string",
            "minLength": 20
          },
          "supersedes": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "validUntil": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "id",
                  "validUntil"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "supersededBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "recordedAt": {
                    "type": "string",
                    "minLength": 20
                  }
                },
                "required": [
                  "id",
                  "recordedAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "withdrawn": {
            "$ref": "#/components/schemas/Retired"
          },
          "reading": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "promptVersion": {
                    "type": "string"
                  },
                  "kindAgrees": {
                    "type": "boolean"
                  },
                  "validFromRead": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "validUntilRead": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "edited": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "promptVersion",
                  "kindAgrees",
                  "validFromRead",
                  "validUntilRead",
                  "edited"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "retainUntil": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "vendorId",
          "kind",
          "title",
          "reference",
          "validFrom",
          "validUntil",
          "note",
          "state",
          "daysToExpiry",
          "file",
          "recordedBy",
          "recordedAt",
          "supersedes",
          "supersededBy",
          "withdrawn",
          "reading",
          "retainUntil"
        ],
        "additionalProperties": false
      },
      "ListVendorMergesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "survivor": {
            "$ref": "#/components/schemas/Survivor2"
          },
          "absorbed": {
            "$ref": "#/components/schemas/Survivor2"
          },
          "state": {
            "type": "string",
            "enum": [
              "PROPOSED",
              "APPROVED",
              "REJECTED",
              "WITHDRAWN",
              "EXPIRED"
            ]
          },
          "proposedFrom": {
            "type": "string",
            "enum": [
              "PERSON",
              "LOOKALIKE_LIST"
            ]
          },
          "proposedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "proposedAt": {
            "type": "string",
            "minLength": 20
          },
          "expiresAt": {
            "type": "string",
            "minLength": 20
          },
          "reason": {
            "type": "string"
          },
          "evidenceSentence": {
            "type": [
              "string",
              "null"
            ]
          },
          "readingPromptVersion": {
            "type": [
              "string",
              "null"
            ]
          },
          "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"
              }
            ]
          },
          "decisionNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "moved": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "BILL",
                        "CONTACT",
                        "SENDER_DOMAIN",
                        "RECURRING_SCHEDULE",
                        "ALIAS",
                        "DOCUMENT",
                        "AGREEMENT",
                        "WITHHOLDING_WAIVER"
                      ]
                    },
                    "count": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "kind",
                    "count"
                  ],
                  "additionalProperties": false
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "entityTimeZone": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "survivor",
          "absorbed",
          "state",
          "proposedFrom",
          "proposedBy",
          "proposedAt",
          "expiresAt",
          "reason",
          "evidenceSentence",
          "readingPromptVersion",
          "decidedBy",
          "decidedAt",
          "decisionNote",
          "moved",
          "entityTimeZone"
        ],
        "additionalProperties": false
      },
      "ListVendorNoticesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/Kind5"
          },
          "state": {
            "type": "string",
            "enum": [
              "DRAFTED",
              "SENT",
              "SUPPRESSED",
              "BOUNCED"
            ]
          },
          "reason": {
            "$ref": "#/components/schemas/Reason"
          },
          "recipientEmail": {
            "type": "string"
          },
          "language": {
            "type": "string",
            "enum": [
              "en",
              "fr",
              "bilingual"
            ]
          },
          "subject": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "entity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "entityTimeZone": {
            "type": "string"
          },
          "address": {
            "$ref": "#/components/schemas/Address"
          },
          "vendor": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "displayName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "inboundEmailId": {
            "type": [
              "string",
              "null"
            ]
          },
          "inboundRefusalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "digestNoticeId": {
            "type": [
              "string",
              "null"
            ]
          },
          "digestHourStart": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "under": {
            "$ref": "#/components/schemas/Under"
          },
          "stoppedBy": {
            "$ref": "#/components/schemas/StoppedBy"
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "sentAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "sentVia": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "PRODUCT",
                  "BY_HAND"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "sentBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "sentNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "transport": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "postmark",
                  "log",
                  "test-copy"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "bouncedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "bounceReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "relayRefusal": {
            "type": [
              "string",
              "null"
            ]
          },
          "draftedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "discarded": {
            "$ref": "#/components/schemas/Retired"
          },
          "sendable": {
            "type": "boolean"
          },
          "outboundApproved": {
            "type": "boolean"
          },
          "sentence": {
            "type": "string"
          },
          "payment": {
            "$ref": "#/components/schemas/Payment"
          },
          "requested": {
            "$ref": "#/components/schemas/StoppedBy"
          },
          "recipientNew": {
            "type": "boolean"
          },
          "recipientConfirmedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "bill": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "number"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "vendorBankingChangeId": {
            "type": [
              "string",
              "null"
            ]
          },
          "slipDistribution": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "reference"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "purchaseOrder": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "number"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "vendorPortalLink": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "contactName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "contactName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "vendorQuery": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "reference"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "vendorStatement": {
            "$ref": "#/components/schemas/VendorStatement"
          }
        },
        "required": [
          "id",
          "kind",
          "state",
          "reason",
          "recipientEmail",
          "language",
          "subject",
          "reference",
          "entity",
          "entityTimeZone",
          "address",
          "vendor",
          "inboundEmailId",
          "inboundRefusalId",
          "digestNoticeId",
          "digestHourStart",
          "under",
          "stoppedBy",
          "createdAt",
          "sentAt",
          "sentVia",
          "sentBy",
          "sentNote",
          "transport",
          "bouncedAt",
          "bounceReason",
          "relayRefusal",
          "draftedBy",
          "discarded",
          "sendable",
          "outboundApproved",
          "sentence",
          "payment",
          "requested",
          "recipientNew",
          "recipientConfirmedBy",
          "bill",
          "vendorBankingChangeId",
          "slipDistribution",
          "purchaseOrder",
          "vendorPortalLink",
          "vendorQuery",
          "vendorStatement"
        ],
        "additionalProperties": false
      },
      "ListVendorPortalLinksResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "vendorContactId": {
            "type": "string"
          },
          "contactName": {
            "type": "string"
          },
          "contactEmail": {
            "type": [
              "string",
              "null"
            ]
          },
          "issuedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "issuedAt": {
            "type": "string",
            "minLength": 20
          },
          "expiresAt": {
            "type": "string",
            "minLength": 20
          },
          "state": {
            "type": "string",
            "enum": [
              "LIVE",
              "EXPIRED",
              "REVOKED"
            ]
          },
          "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"
            ]
          },
          "lastOpenedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "opens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "invitation": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "noticeId": {
                    "type": "string"
                  },
                  "state": {
                    "type": "string"
                  },
                  "sentAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 20
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "noticeId",
                  "state",
                  "sentAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "vendorContactId",
          "contactName",
          "contactEmail",
          "issuedBy",
          "issuedAt",
          "expiresAt",
          "state",
          "revokedAt",
          "revokedBy",
          "revokeReason",
          "lastOpenedAt",
          "opens",
          "invitation"
        ],
        "additionalProperties": false
      },
      "ListVendorQueryMessagesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "seq": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "direction": {
            "type": "string",
            "enum": [
              "FROM_SUPPLIER",
              "FROM_US"
            ]
          },
          "channel": {
            "type": "string",
            "enum": [
              "PORTAL",
              "EMAIL",
              "BY_HAND"
            ]
          },
          "body": {
            "type": "string"
          },
          "at": {
            "type": "string",
            "minLength": 20
          },
          "by": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SUPPLIER_CONTACT",
                  "STAFF"
                ]
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "kind",
              "name"
            ],
            "additionalProperties": false
          },
          "delivery": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "state": {
                    "type": "string",
                    "enum": [
                      "PAGE",
                      "EMAILED",
                      "DRAFTED",
                      "BOUNCED",
                      "BY_HAND",
                      "NOT_SENT"
                    ]
                  },
                  "noticeId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "sentence": {
                    "type": "string"
                  }
                },
                "required": [
                  "state",
                  "noticeId",
                  "sentence"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "told": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "version": {
                    "type": "number",
                    "const": 1
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "en",
                      "fr"
                    ]
                  },
                  "evidenceAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "keys": {
                    "$ref": "#/components/schemas/Keys"
                  },
                  "sentence": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string",
                            "maxLength": 600
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "STANDARD",
                              "AGENT_DRAFT",
                              "AGENT_DRAFT_EDITED",
                              "PERSON"
                            ]
                          },
                          "promptVersion": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "text",
                          "source",
                          "promptVersion"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "draft": {
                    "type": "object",
                    "properties": {
                      "requested": {
                        "type": "boolean"
                      },
                      "category": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "PAYMENT_STATUS",
                              "SHORT_PAID",
                              "NOT_RECEIVED",
                              "DUE_DATE",
                              "AMOUNT_DIFFERS",
                              "REMITTANCE_ADVICE",
                              "CREDIT",
                              "OTHER"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "proposedKeys": {
                        "$ref": "#/components/schemas/ProposedKeys"
                      }
                    },
                    "required": [
                      "requested",
                      "category",
                      "proposedKeys"
                    ],
                    "additionalProperties": false
                  },
                  "sourceLabel": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "version",
                  "language",
                  "evidenceAt",
                  "keys",
                  "sentence",
                  "draft",
                  "sourceLabel"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "mentionsBanking": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "seq",
          "direction",
          "channel",
          "body",
          "at",
          "by",
          "delivery",
          "told",
          "mentionsBanking"
        ],
        "additionalProperties": false
      },
      "ListVendorQueryPoliciesResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "enabledBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "enabledAt": {
            "type": "string",
            "minLength": 20
          },
          "expiresAt": {
            "type": "string",
            "minLength": 20
          },
          "dailyCap": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200
          },
          "end": {
            "$ref": "#/components/schemas/Retired"
          },
          "state": {
            "type": "string",
            "enum": [
              "LIVE",
              "EXPIRED",
              "ENDED"
            ]
          },
          "filedToday": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "pausedUntil": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "filedTotal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "setAsideTotal": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "enabledBy",
          "enabledAt",
          "expiresAt",
          "dailyCap",
          "end",
          "state",
          "filedToday",
          "pausedUntil",
          "filedTotal",
          "setAsideTotal"
        ],
        "additionalProperties": false
      },
      "ListVendorSenderDomainsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "KNOWN",
              "RETIRED"
            ]
          },
          "learnedFrom": {
            "type": "string",
            "enum": [
              "APPROVED_BILL",
              "BACKFILL"
            ]
          },
          "firstBill": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "number": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "number"
            ],
            "additionalProperties": false
          },
          "learnedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "firstSeenAt": {
            "type": "string",
            "minLength": 20
          },
          "lastSeenAt": {
            "type": "string",
            "minLength": 20
          },
          "messageCount": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "authenticatedCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "retired": {
            "$ref": "#/components/schemas/Retired"
          },
          "restored": {
            "$ref": "#/components/schemas/Retired"
          }
        },
        "required": [
          "id",
          "domain",
          "state",
          "learnedFrom",
          "firstBill",
          "learnedBy",
          "firstSeenAt",
          "lastSeenAt",
          "messageCount",
          "authenticatedCount",
          "retired",
          "restored"
        ],
        "additionalProperties": false
      },
      "ListVendorWithholdingWaiversResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "craReference": {
            "type": "string"
          },
          "rateBp": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "validFrom": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "validTo": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "entity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "vendorDocumentId": {
            "type": "string"
          },
          "documentTitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "standing": {
            "type": "string",
            "enum": [
              "IN_FORCE",
              "NOT_YET",
              "EXPIRED",
              "ENDED"
            ]
          },
          "recordedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "recordedAt": {
            "type": "string",
            "minLength": 20
          },
          "ended": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "on": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "by": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "at": {
                    "type": "string",
                    "minLength": 20
                  },
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "on",
                  "by",
                  "at",
                  "reason"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "paymentsUnder": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "craReference",
          "rateBp",
          "validFrom",
          "validTo",
          "entity",
          "vendorDocumentId",
          "documentTitle",
          "standing",
          "recordedBy",
          "recordedAt",
          "ended",
          "paymentsUnder"
        ],
        "additionalProperties": false
      },
      "ListVendorsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "legalName": {
            "type": [
              "string",
              "null"
            ]
          },
          "taxNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "paymentTerms": {
            "$ref": "#/components/schemas/PaymentTerms"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "defaultCurrency": {
            "type": [
              "string",
              "null"
            ]
          },
          "language": {
            "type": "string",
            "enum": [
              "en",
              "fr"
            ]
          },
          "qstNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "gstRegistrationState": {
            "type": "string",
            "enum": [
              "REGISTERED",
              "NOT_REGISTERED",
              "UNKNOWN"
            ]
          },
          "residency": {
            "type": "string",
            "enum": [
              "CANADA",
              "NON_RESIDENT",
              "UNKNOWN"
            ]
          },
          "acceptance": {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "enum": [
                  "PENDING_ACCEPTANCE",
                  "ACCEPTED",
                  "REFUSED",
                  "NOT_REVIEWED"
                ]
              },
              "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"
                  }
                ]
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "state",
              "by",
              "at",
              "note"
            ],
            "additionalProperties": false
          },
          "addressLine1": {
            "type": [
              "string",
              "null"
            ]
          },
          "addressLine2": {
            "type": [
              "string",
              "null"
            ]
          },
          "city": {
            "type": [
              "string",
              "null"
            ]
          },
          "region": {
            "type": [
              "string",
              "null"
            ]
          },
          "postalCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "country": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "ARCHIVED"
            ]
          },
          "archivedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "bankingState": {
            "type": "string",
            "enum": [
              "NONE",
              "PENDING",
              "VERIFIED"
            ]
          },
          "mergedInto": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "displayName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "updatedAt": {
            "type": "string",
            "minLength": 20
          },
          "customFields": {
            "$ref": "#/components/schemas/CustomFields2"
          }
        },
        "required": [
          "id",
          "displayName",
          "legalName",
          "taxNumber",
          "paymentTerms",
          "email",
          "phone",
          "address",
          "defaultCurrency",
          "language",
          "qstNumber",
          "gstRegistrationState",
          "residency",
          "acceptance",
          "addressLine1",
          "addressLine2",
          "city",
          "region",
          "postalCode",
          "country",
          "status",
          "archivedAt",
          "bankingState",
          "mergedInto",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ListWarehouseDestinationsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{1,31}$"
          },
          "kindLabel": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "provisioning",
              "awaiting-access",
              "active",
              "paused",
              "removed"
            ]
          },
          "target": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "fields": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "pattern": "^[a-zA-Z][a-zA-Z0-9]{0,31}$"
                },
                "additionalProperties": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1024
                }
              }
            },
            "required": [
              "label",
              "fields"
            ],
            "additionalProperties": false
          },
          "options": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "pattern": "^[a-zA-Z][a-zA-Z0-9]{0,31}$"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 255
                },
                {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                {
                  "type": "boolean"
                }
              ]
            }
          },
          "verificationLabel": {
            "type": "string"
          },
          "location": {
            "type": [
              "string",
              "null"
            ]
          },
          "inCanada": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "residencyAcknowledged": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "at": {
                    "type": "string",
                    "minLength": 20
                  },
                  "byName": {
                    "type": "string"
                  }
                },
                "required": [
                  "at",
                  "byName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "credential": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "fingerprint": {
                    "type": "string"
                  },
                  "rotating": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "fingerprint",
                  "rotating"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "pauseAfterHours": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "pause": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "failing"
                    ]
                  },
                  "at": {
                    "type": "string",
                    "minLength": 20
                  },
                  "byName": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "note": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "reason",
                  "at",
                  "byName",
                  "note"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "failing": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "since": {
                    "type": "string",
                    "minLength": 20
                  },
                  "code": {
                    "type": "string",
                    "enum": [
                      "access_denied",
                      "target_unverified",
                      "target_not_found",
                      "schema_conflict",
                      "quota",
                      "transient",
                      "internal"
                    ]
                  },
                  "remedy": {
                    "type": "string"
                  },
                  "nextAttemptAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 20
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "since",
                  "code",
                  "remedy",
                  "nextAttemptAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "lastSuccessAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "lastTest": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "at": {
                    "type": "string",
                    "minLength": 20
                  },
                  "ok": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "at",
                  "ok"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "sync": {
            "type": "object",
            "properties": {
              "position": {
                "type": "string",
                "pattern": "^(0|[1-9]\\d{0,18})$"
              },
              "ledgerPosition": {
                "type": "string",
                "pattern": "^(0|[1-9]\\d{0,18})$"
              },
              "behindBy": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "oldestWaitingAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "backfill": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "jobId": {
                        "type": "string"
                      },
                      "done": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "total": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "jobId",
                      "done",
                      "total"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "position",
              "ledgerPosition",
              "behindBy",
              "oldestWaitingAt",
              "backfill"
            ],
            "additionalProperties": false
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "createdByName": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "kindLabel",
          "state",
          "target",
          "options",
          "verificationLabel",
          "location",
          "inCanada",
          "residencyAcknowledged",
          "credential",
          "pauseAfterHours",
          "pause",
          "failing",
          "lastSuccessAt",
          "lastTest",
          "sync",
          "createdAt",
          "createdByName"
        ],
        "additionalProperties": false
      },
      "ListWorkflowRunsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "workflow": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "id",
              "name",
              "version"
            ],
            "additionalProperties": false
          },
          "kind": {
            "type": "string",
            "enum": [
              "APPROVAL",
              "AUTOMATION"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ROUTED",
              "QUEUED",
              "RUNNING",
              "SUCCEEDED",
              "PROPOSED",
              "FAILED",
              "SKIPPED",
              "CAPPED",
              "LOOP_STOPPED",
              "CANCELLED",
              "REFUSED"
            ]
          },
          "target": {
            "$ref": "#/components/schemas/Target2"
          },
          "depth": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "parentRunId": {
            "type": [
              "string",
              "null"
            ]
          },
          "sentence": {
            "type": "string"
          },
          "cappedCount": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "traceId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "finishedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "position": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "label": {
                  "type": "string"
                },
                "operation": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "PENDING",
                    "SUCCEEDED",
                    "PROPOSED",
                    "FAILED",
                    "SKIPPED"
                  ]
                },
                "record": {
                  "$ref": "#/components/schemas/Target2"
                },
                "proposalId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "error": {
                  "$ref": "#/components/schemas/Refusal"
                }
              },
              "required": [
                "position",
                "label",
                "operation",
                "status",
                "record",
                "proposalId",
                "error"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "workflow",
          "kind",
          "status",
          "target",
          "depth",
          "parentRunId",
          "sentence",
          "cappedCount",
          "jobId",
          "traceId",
          "createdAt",
          "finishedAt"
        ],
        "additionalProperties": false
      },
      "ListWorkflowsResponseItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "APPROVAL",
              "AUTOMATION"
            ]
          },
          "subject": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "BILL",
                  "INVOICE",
                  "PURCHASE_ORDER"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "ACTIVE",
              "PAUSED",
              "EXPIRED",
              "RETIRED"
            ]
          },
          "pauseReason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "PERSON",
                  "OWNER_GONE",
                  "LOOP"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "position": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "owner": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "active": {
            "$ref": "#/components/schemas/Active"
          },
          "draft": {
            "$ref": "#/components/schemas/Active"
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "runsToday": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lastRunAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "may": {
            "type": "object",
            "properties": {
              "edit": {
                "type": "boolean"
              },
              "activate": {
                "type": "boolean"
              },
              "pause": {
                "type": "boolean"
              },
              "resume": {
                "type": "boolean"
              },
              "retire": {
                "type": "boolean"
              }
            },
            "required": [
              "edit",
              "activate",
              "pause",
              "resume",
              "retire"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "kind",
          "subject",
          "status",
          "pauseReason",
          "position",
          "owner",
          "active",
          "draft",
          "expiresAt",
          "runsToday",
          "lastRunAt",
          "may"
        ],
        "additionalProperties": false
      },
      "LiveOption1": {
        "type": "object",
        "properties": {
          "ruleId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PROPOSED",
              "ACTIVE",
              "DISCARDED",
              "RETIRED"
            ]
          },
          "origin": {
            "type": "string",
            "enum": [
              "WRITTEN",
              "LEARNED"
            ]
          },
          "authorName": {
            "type": "string"
          },
          "authorId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "expiresAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "expiresOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "expired": {
            "type": "boolean"
          },
          "entity": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "interpretation": {
            "type": "string"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string",
                  "enum": [
                    "ACCOUNT",
                    "SUPPLY_CATEGORY",
                    "ITC_KIND",
                    "COMMERCIAL_USE",
                    "PROVINCIAL_SERVICE",
                    "PROPERTY_REGION",
                    "DIMENSION"
                  ]
                },
                "dimensionTypeId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "valueLabel": {
                  "type": "string"
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "FILLING",
                    "PAUSED",
                    "EXPECTING"
                  ]
                },
                "pausedWhy": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "field",
                "dimensionTypeId",
                "valueLabel",
                "state",
                "pausedWhy"
              ],
              "additionalProperties": false
            }
          },
          "stats": {
            "$ref": "#/components/schemas/FillStatsOption1"
          },
          "replacesRuleId": {
            "type": [
              "string",
              "null"
            ]
          },
          "previewId": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "ruleId",
          "status",
          "origin",
          "authorName",
          "authorId",
          "createdAt",
          "expiresAt",
          "expiresOn",
          "expired",
          "entity",
          "interpretation",
          "fields",
          "stats",
          "replacesRuleId",
          "previewId"
        ],
        "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
      },
      "MergeDimensionValueResponse": {
        "type": "object",
        "properties": {
          "value": {
            "$ref": "#/components/schemas/ValuesItem"
          },
          "mergedIntoId": {
            "type": [
              "string",
              "null"
            ]
          },
          "repointedValueIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "value",
          "mergedIntoId",
          "repointedValueIds"
        ],
        "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
        }
      },
      "Mirror": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/MirrorOption1"
          },
          {
            "type": "null"
          }
        ]
      },
      "MirrorOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "number": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "APPROVED",
              "PARTIALLY_PAID",
              "PAID",
              "VOID",
              "WRITTEN_OFF"
            ]
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "subtotalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "taxMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "totalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "openMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "issueDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "customer": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "displayName"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "number",
          "status",
          "currency",
          "subtotalMinor",
          "taxMinor",
          "totalMinor",
          "openMinor",
          "issueDate",
          "customer"
        ],
        "additionalProperties": false
      },
      "Names": {
        "type": "object",
        "properties": {
          "placed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "notFound": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "placed",
          "notFound"
        ],
        "additionalProperties": false
      },
      "Need": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "minLength": 8,
            "maxLength": 600
          },
          "source": {
            "type": "string",
            "enum": [
              "STANDARD",
              "AGENT_DRAFT",
              "AGENT_DRAFT_EDITED",
              "PERSON"
            ]
          },
          "promptVersion": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "text",
          "source",
          "promptVersion"
        ],
        "additionalProperties": false
      },
      "NewPayees": {
        "maxItems": 500,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "paymentId": {
              "type": "string"
            },
            "sequence": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "vendor": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "displayName": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "displayName"
              ],
              "additionalProperties": false
            },
            "amountMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "priorPaymentCount": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "historicalMaxMinor": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "multipleTenths": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "paymentId",
            "sequence",
            "vendor",
            "amountMinor",
            "currency",
            "priorPaymentCount",
            "historicalMaxMinor",
            "multipleTenths"
          ],
          "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
        }
      },
      "NotABill": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "at": {
                "type": "string",
                "minLength": 20
              },
              "byName": {
                "type": "string"
              },
              "note": {
                "type": "string"
              }
            },
            "required": [
              "at",
              "byName"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "NoteOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "periodYear": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodMonth": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodLabel": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PROPOSED",
              "ACCEPTED",
              "DECLINED"
            ]
          },
          "reasoning": {
            "type": "string"
          },
          "factsDigest": {
            "type": "string"
          },
          "blocks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "accountId": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                },
                "acceptedText": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "confidenceBp": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 10000
                },
                "entries": {
                  "$ref": "#/components/schemas/Entries"
                },
                "modelSentence": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "monthMinorAtDraft": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                }
              },
              "required": [
                "accountId",
                "code",
                "name",
                "text",
                "acceptedText",
                "confidenceBp",
                "entries",
                "modelSentence",
                "monthMinorAtDraft"
              ],
              "additionalProperties": false
            }
          },
          "edited": {
            "type": "boolean"
          },
          "draftedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "draftedAt": {
            "type": "string",
            "minLength": 20
          },
          "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"
              }
            ]
          },
          "declineReason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "periodYear",
          "periodMonth",
          "periodLabel",
          "status",
          "reasoning",
          "factsDigest",
          "blocks",
          "edited",
          "draftedBy",
          "draftedAt",
          "decidedBy",
          "decidedAt",
          "declineReason"
        ],
        "additionalProperties": false
      },
      "OpenDraft": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "noticeId": {
                "type": "string"
              },
              "byName": {
                "type": "string"
              },
              "recipientEmail": {
                "type": "string"
              }
            },
            "required": [
              "noticeId",
              "byName",
              "recipientEmail"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "OrderBy": {
        "default": [],
        "maxItems": 4,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "key": {
              "type": "string",
              "minLength": 1
            },
            "direction": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          "required": [
            "key",
            "direction"
          ],
          "additionalProperties": false
        }
      },
      "Owner": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "seated": {
            "type": "boolean"
          },
          "because": {
            "type": "string",
            "enum": [
              "SUPPLIER_OWNER",
              "SUPPLIER_CONTACT",
              "ADDRESS_WATCHER",
              "LINK_ISSUER",
              "POLICY_AUTHOR",
              "RAISER",
              "NAMED"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "seated",
          "because"
        ],
        "additionalProperties": false
      },
      "Pages": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "from": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "to": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "from",
              "to"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Pair": {
        "type": "object",
        "properties": {
          "asked": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "leftOut": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "outcome": {
            "type": "string",
            "enum": [
              "ANSWERED",
              "NOTHING_TO_ASK",
              "PROVIDER",
              "DISCLOSURE",
              "BUDGET",
              "LIMIT",
              "UNPARSABLE",
              "REFUSED",
              "UNKNOWN_REF",
              "STOPPED_AFTER_THREE_DECLINES"
            ]
          },
          "why": {
            "type": [
              "string",
              "null"
            ]
          },
          "promptVersion": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "asked",
          "leftOut",
          "outcome",
          "why",
          "promptVersion"
        ],
        "additionalProperties": false
      },
      "PaperFacts": {
        "anyOf": [
          {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "DOCUMENT_REQUESTED"
                  },
                  "common": {
                    "$ref": "#/components/schemas/Common"
                  },
                  "items": {
                    "minItems": 1,
                    "maxItems": 12,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "documentKind": {
                          "type": "string",
                          "enum": [
                            "WSIB_CLEARANCE",
                            "INSURANCE_CERTIFICATE",
                            "MASTER_AGREEMENT",
                            "W8BEN",
                            "DIRECT_DEPOSIT_FORM",
                            "WITHHOLDING_WAIVER",
                            "OTHER"
                          ]
                        },
                        "title": {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 160
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "MISSING",
                            "LAPSED",
                            "EXPIRING"
                          ]
                        },
                        "validUntil": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "documentKind",
                        "title",
                        "state",
                        "validUntil"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "sentence": {
                    "$ref": "#/components/schemas/Paragraph"
                  }
                },
                "required": [
                  "kind",
                  "common",
                  "items",
                  "sentence"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "NON_RENEWAL_NOTICE"
                  },
                  "common": {
                    "$ref": "#/components/schemas/Common"
                  },
                  "agreement": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "maxLength": 160
                      },
                      "endsOn": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "noticeDays": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "name",
                      "endsOn",
                      "noticeDays"
                    ],
                    "additionalProperties": false
                  },
                  "sentence": {
                    "$ref": "#/components/schemas/Paragraph"
                  }
                },
                "required": [
                  "kind",
                  "common",
                  "agreement",
                  "sentence"
                ],
                "additionalProperties": false
              }
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "Paragraph": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Need"
          },
          {
            "type": "null"
          }
        ]
      },
      "Params": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "from": {
                  "type": "string",
                  "const": "constant"
                },
                "value": {
                  "type": [
                    "string",
                    "number",
                    "boolean",
                    "null"
                  ]
                }
              },
              "required": [
                "from",
                "value"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "from": {
                  "type": "string",
                  "const": "record"
                },
                "field": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                }
              },
              "required": [
                "from",
                "field"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "PassagesItem": {
        "type": "object",
        "properties": {
          "chunkId": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/Source2"
          },
          "pages": {
            "$ref": "#/components/schemas/Pages"
          },
          "span": {
            "$ref": "#/components/schemas/Span"
          },
          "sectionPath": {
            "maxItems": 8,
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "header": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": "string",
            "maxLength": 2000
          },
          "language": {
            "type": "string",
            "enum": [
              "en",
              "fr",
              "other"
            ]
          },
          "matchedBy": {
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "meaning",
                "words",
                "identifier"
              ]
            }
          },
          "score": {
            "type": "number"
          },
          "citation": {
            "type": "string"
          },
          "untrusted": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "chunkId",
          "source",
          "pages",
          "span",
          "sectionPath",
          "header",
          "text",
          "language",
          "matchedBy",
          "score",
          "citation",
          "untrusted"
        ],
        "additionalProperties": false
      },
      "Pattern": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "billId": {
                "type": "string"
              },
              "billNumber": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "billId",
              "billNumber"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Payment": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "runId": {
                "type": "string"
              },
              "paymentDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "amountMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              }
            },
            "required": [
              "id",
              "runId",
              "paymentDate",
              "amountMinor",
              "currency"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "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"
          }
        ]
      },
      "PendingChange": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "proposedBy": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "proposedAt": {
                "type": "string",
                "minLength": 20
              }
            },
            "required": [
              "id",
              "proposedBy",
              "proposedAt"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Performance": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "region": {
              "type": "string",
              "pattern": "^(CA|US)-[A-Z]{2}$"
            },
            "share": {
              "type": "string",
              "pattern": "^(0(\\.\\d+)?|1(\\.0+)?)$"
            }
          },
          "required": [
            "region",
            "share"
          ],
          "additionalProperties": false
        }
      },
      "Period": {
        "type": "object",
        "properties": {
          "year": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "month": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "label": {
            "type": "string"
          },
          "start": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "end": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          }
        },
        "required": [
          "year",
          "month",
          "label",
          "start",
          "end"
        ],
        "additionalProperties": false
      },
      "Period2": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "to": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          }
        },
        "required": [
          "from",
          "to"
        ],
        "additionalProperties": false
      },
      "Plan": {
        "type": "object",
        "properties": {
          "plannedOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "plannedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "plannedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "findings": {
            "$ref": "#/components/schemas/Findings"
          }
        },
        "required": [
          "plannedOn",
          "plannedBy",
          "plannedAt",
          "findings"
        ],
        "additionalProperties": false
      },
      "PlanBillResponse": {
        "type": "object",
        "properties": {
          "billId": {
            "type": "string"
          },
          "changed": {
            "type": "boolean"
          },
          "plan": {
            "$ref": "#/components/schemas/Plan"
          },
          "previousOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "billId",
          "changed",
          "plan",
          "previousOn"
        ],
        "additionalProperties": false
      },
      "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
      },
      "PreparePaymentRunResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "RELEASED",
              "CANCELLED"
            ]
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "bankAccount": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "displayName"
            ],
            "additionalProperties": false
          },
          "paymentDate": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "totalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "paymentCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "preparedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "preparedAt": {
            "type": "string",
            "minLength": 20
          },
          "releasedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "releasedAt": {
            "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"
              }
            ]
          },
          "cancelledAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "cancelReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "reversalState": {
            "type": "string",
            "enum": [
              "NONE",
              "PARTLY_REVERSED",
              "REVERSED"
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "EFT",
              "CHEQUE",
              "WIRE"
            ]
          },
          "bankState": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "NOT_LODGED",
                  "AWAITING_BANK",
                  "ACCEPTED",
                  "REJECTED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "payments": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "sequence": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "withheldMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "marks": {
                      "type": "object",
                      "properties": {
                        "newPayee": {
                          "type": "boolean"
                        },
                        "aboveHistoricalMax": {
                          "type": "boolean"
                        },
                        "historicalMaxMinor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "priorPaymentCount": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "newPayeeNote": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "aboveHistoricalMaxNote": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "newPayee",
                        "aboveHistoricalMax",
                        "historicalMaxMinor",
                        "priorPaymentCount",
                        "newPayeeNote",
                        "aboveHistoricalMaxNote"
                      ],
                      "additionalProperties": false
                    },
                    "vendor": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "displayName"
                      ],
                      "additionalProperties": false
                    },
                    "bankingVerifiedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "bankingVerifiedBy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "amountMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "currency": {
                      "type": "string",
                      "pattern": "^[A-Z]{3}$"
                    },
                    "callbackRequired": {
                      "type": "boolean"
                    },
                    "callbackNote": {
                      "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"
                        }
                      ]
                    },
                    "bills": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "withholding": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "baseMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "rateBp": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "withheldMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "grossMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "netMinor": {
                                    "type": "string",
                                    "pattern": "^-?\\d+$"
                                  },
                                  "waiver": {
                                    "$ref": "#/components/schemas/Waiver"
                                  },
                                  "decisions": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "position": {
                                          "anyOf": [
                                            {
                                              "type": "integer",
                                              "minimum": -9007199254740991,
                                              "maximum": 9007199254740991
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ]
                                        },
                                        "decision": {
                                          "type": "string",
                                          "enum": [
                                            "IN_CANADA",
                                            "OUTSIDE_CANADA",
                                            "NOT_A_SERVICE"
                                          ]
                                        },
                                        "note": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "by": {
                                          "type": "object",
                                          "properties": {
                                            "id": {
                                              "type": "string"
                                            },
                                            "name": {
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "id",
                                            "name"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "decidedAt": {
                                          "type": "string",
                                          "minLength": 20
                                        }
                                      },
                                      "required": [
                                        "position",
                                        "decision",
                                        "note",
                                        "by",
                                        "decidedAt"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "baseMinor",
                                  "rateBp",
                                  "withheldMinor",
                                  "grossMinor",
                                  "netMinor",
                                  "waiver",
                                  "decisions"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "billId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "extractionId": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "invoiceNumber": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "invoiceDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "dueDate": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "amountMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "voidedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 20
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "appliedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "owedMinor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "shortReason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "deductions": {
                            "$ref": "#/components/schemas/Deductions"
                          },
                          "discount": {
                            "anyOf": [
                              {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "state": {
                                        "type": "string",
                                        "const": "TAKEN"
                                      },
                                      "amountMinor": {
                                        "type": "string",
                                        "pattern": "^-?\\d+$"
                                      },
                                      "discountDate": {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      "words": {
                                        "type": "string"
                                      },
                                      "account": {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "code": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "code",
                                          "name"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "state",
                                      "amountMinor",
                                      "discountDate",
                                      "words",
                                      "account"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "state": {
                                        "type": "string",
                                        "const": "DECLINED"
                                      },
                                      "amountMinor": {
                                        "type": "string",
                                        "pattern": "^-?\\d+$"
                                      },
                                      "discountDate": {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      "words": {
                                        "type": "string"
                                      },
                                      "reason": {
                                        "type": "string"
                                      },
                                      "declinedBy": {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "name"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "state",
                                      "amountMinor",
                                      "discountDate",
                                      "words",
                                      "reason",
                                      "declinedBy"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "state": {
                                        "type": "string",
                                        "const": "MISSED"
                                      },
                                      "amountMinor": {
                                        "type": "string",
                                        "pattern": "^-?\\d+$"
                                      },
                                      "discountDate": {
                                        "type": "string",
                                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                      },
                                      "words": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "state",
                                      "amountMinor",
                                      "discountDate",
                                      "words"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "withholding",
                          "billId",
                          "extractionId",
                          "invoiceNumber",
                          "invoiceDate",
                          "dueDate",
                          "amountMinor",
                          "voidedAt",
                          "appliedMinor",
                          "owedMinor",
                          "shortReason",
                          "deductions",
                          "discount"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "bankingSignals": {
                      "$ref": "#/components/schemas/BankingSignals"
                    },
                    "billSignals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "billId": {
                            "type": "string"
                          },
                          "number": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "signal": {
                            "$ref": "#/components/schemas/StoredOption1"
                          }
                        },
                        "required": [
                          "billId",
                          "number",
                          "signal"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "cheque": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "number": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "ISSUED",
                                "VOIDED"
                              ]
                            },
                            "voidedAt": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 20
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "voidReason": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "number",
                            "state",
                            "voidedAt",
                            "voidReason"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "removal": {
                      "$ref": "#/components/schemas/Retired"
                    },
                    "reversal": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "RETURNED",
                                "RUN_REVERSED"
                              ]
                            },
                            "by": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            },
                            "at": {
                              "type": "string",
                              "minLength": 20
                            },
                            "reversalEntryId": {
                              "type": "string"
                            },
                            "reversalEntryNumber": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "returnCode": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "R900",
                                    "R902",
                                    "R903",
                                    "R904",
                                    "R905",
                                    "R909",
                                    "R910",
                                    "R911",
                                    "R912",
                                    "R922",
                                    "R990",
                                    "OTHER"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "returnNote": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "returnedOn": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "bankingFlagged": {
                              "type": "boolean"
                            },
                            "document": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "fileName": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "fileName"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "by",
                            "at",
                            "reversalEntryId",
                            "reversalEntryNumber",
                            "returnCode",
                            "returnNote",
                            "returnedOn",
                            "bankingFlagged",
                            "document"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "bankLine": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "payeeName": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "crossReference": {
                              "type": "string"
                            },
                            "sundry": {
                              "type": "string"
                            },
                            "fileSequence": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "PREVIEW",
                                "FILE"
                              ]
                            }
                          },
                          "required": [
                            "payeeName",
                            "crossReference",
                            "sundry",
                            "fileSequence",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "rail": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "payoutId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "QUEUED",
                                "SUBMITTED",
                                "SETTLED",
                                "FAILED",
                                "RETURNED"
                              ]
                            },
                            "providerStatus": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "reasonWords": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 300
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "mappedReturnCode": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "enum": [
                                    "R900",
                                    "R902",
                                    "R903",
                                    "R904",
                                    "R905",
                                    "R909",
                                    "R910",
                                    "R911",
                                    "R912",
                                    "R922",
                                    "R990",
                                    "OTHER"
                                  ]
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "lastEventAt": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 20
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "payoutId",
                            "status",
                            "providerStatus",
                            "reasonWords",
                            "mappedReturnCode",
                            "lastEventAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "sequence",
                    "withheldMinor",
                    "marks",
                    "vendor",
                    "bankingVerifiedAt",
                    "bankingVerifiedBy",
                    "amountMinor",
                    "currency",
                    "callbackRequired",
                    "callbackNote",
                    "entryNumber",
                    "entryStatus",
                    "bills",
                    "bankingSignals",
                    "billSignals",
                    "cheque",
                    "removal",
                    "reversal",
                    "bankLine",
                    "rail"
                  ],
                  "additionalProperties": false
                }
              },
              "nextCursor": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "total": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "data",
              "nextCursor",
              "total"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "status",
          "entityId",
          "entityName",
          "entityTimeZone",
          "bankAccount",
          "paymentDate",
          "currency",
          "totalMinor",
          "paymentCount",
          "preparedBy",
          "preparedAt",
          "releasedBy",
          "releasedAt",
          "cancelledBy",
          "cancelledAt",
          "cancelReason",
          "reversalState",
          "method",
          "bankState",
          "payments"
        ],
        "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
      },
      "PreviewOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "considered": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "matched": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "from": {
            "type": "string",
            "minLength": 20
          },
          "to": {
            "type": "string",
            "minLength": 20
          },
          "examples": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ref": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "href": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "outcome": {
                  "type": "string"
                }
              },
              "required": [
                "ref",
                "label",
                "href",
                "outcome"
              ],
              "additionalProperties": false
            }
          },
          "takenAt": {
            "type": "string",
            "minLength": 20
          },
          "fresh": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "considered",
          "matched",
          "from",
          "to",
          "examples",
          "takenAt",
          "fresh"
        ],
        "additionalProperties": false
      },
      "PreviewRuleResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "ruleId": {
            "type": "string"
          },
          "ruleVersion": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "consideredCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "matchedCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "skippedForCurrency": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "totalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "largestMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "currency": {
            "type": "string"
          },
          "matched": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "entryId": {
                  "type": "string"
                },
                "entryRef": {
                  "type": "string"
                },
                "entryDate": {
                  "type": "string"
                },
                "memo": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "currency": {
                  "type": "string"
                }
              },
              "required": [
                "entryId",
                "entryRef",
                "entryDate",
                "memo",
                "amountMinor",
                "currency"
              ],
              "additionalProperties": false
            }
          },
          "createdAt": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          },
          "subject": {
            "default": "ENTRY",
            "type": "string",
            "enum": [
              "ENTRY",
              "BILL",
              "VENDOR",
              "RUN",
              "INVOICE"
            ]
          },
          "billMatched": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "billId": {
                  "type": "string"
                },
                "revision": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "supplierName": {
                  "type": "string"
                },
                "number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "totalMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "currency": {
                  "type": "string"
                },
                "effect": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "desk": {
                          "$ref": "#/components/schemas/Desk"
                        },
                        "stageCount": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2
                        }
                      },
                      "required": [
                        "desk",
                        "stageCount"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "hold": {
                          "type": "boolean",
                          "const": true
                        },
                        "capReached": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "hold",
                        "capReached"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "required": [
                "billId",
                "revision",
                "supplierName",
                "number",
                "totalMinor",
                "currency",
                "effect"
              ],
              "additionalProperties": false
            }
          },
          "toleranceMatched": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "billId": {
                  "type": "string"
                },
                "revision": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "supplierName": {
                  "type": "string"
                },
                "number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "currency": {
                  "type": "string"
                },
                "totalMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "tolerated": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string",
                        "enum": [
                          "PO_PRICE_VARIANCE",
                          "PO_QUANTITY_VARIANCE",
                          "PO_OVER_BILLED",
                          "PO_NOT_RECEIVED"
                        ]
                      },
                      "line": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "valueMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "bp": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "code",
                      "line",
                      "valueMinor",
                      "bp"
                    ],
                    "additionalProperties": false
                  }
                },
                "capReached": {
                  "type": "boolean"
                }
              },
              "required": [
                "billId",
                "revision",
                "supplierName",
                "number",
                "currency",
                "totalMinor",
                "tolerated",
                "capReached"
              ],
              "additionalProperties": false
            }
          },
          "cut": {
            "default": false,
            "type": "boolean"
          },
          "profileMatched": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "billId": {
                  "type": "string"
                },
                "number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "billDate": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "filled": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "agrees": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "differs": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "position": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "field": {
                        "type": "string"
                      },
                      "profile": {
                        "type": "string"
                      },
                      "approved": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "position",
                      "field",
                      "profile",
                      "approved"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "billId",
                "number",
                "billDate",
                "filled",
                "agrees",
                "differs"
              ],
              "additionalProperties": false
            }
          },
          "runWeeks": {
            "default": [],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "weekStart": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "passOn": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "consideredCount": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "cut": {
                  "type": "boolean"
                },
                "takenCount": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "takenAppliedMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "takenCashMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "lines": {
                  "maxItems": 500,
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LinesItem2"
                  }
                }
              },
              "required": [
                "weekStart",
                "passOn",
                "consideredCount",
                "cut",
                "takenCount",
                "takenAppliedMinor",
                "takenCashMinor",
                "lines"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "ruleId",
          "ruleVersion",
          "consideredCount",
          "matchedCount",
          "skippedForCurrency",
          "totalMinor",
          "largestMinor",
          "currency",
          "matched",
          "createdAt",
          "expiresAt",
          "subject",
          "billMatched",
          "toleranceMatched",
          "cut",
          "profileMatched",
          "runWeeks"
        ],
        "additionalProperties": false
      },
      "PriorMethods": {
        "maxItems": 8,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "RUN",
                "CARD",
                "PAD",
                "ACCOUNT",
                "CHEQUE",
                "WIRE",
                "ETRANSFER",
                "OTHER"
              ]
            },
            "count": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "method",
            "count"
          ],
          "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
      },
      "ProducePackResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "periodYear": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodMonth": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "periodLabel": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "FINAL"
            ]
          },
          "sha256": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "producedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "producedAt": {
            "type": "string",
            "minLength": 20
          },
          "latest": {
            "type": "boolean"
          },
          "content": {
            "type": "object",
            "properties": {
              "entity": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "timeZone": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name",
                  "currency",
                  "timeZone"
                ],
                "additionalProperties": false
              },
              "ledgerName": {
                "type": "string"
              },
              "period": {
                "type": "object",
                "properties": {
                  "year": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "month": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "start": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "end": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "label": {
                    "type": "string"
                  },
                  "fiscalYearStart": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "note": {
                    "default": null,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "fiscalYearEndMonth": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 12
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "year",
                  "month",
                  "start",
                  "end",
                  "label",
                  "fiscalYearStart",
                  "note",
                  "fiscalYearEndMonth"
                ],
                "additionalProperties": false
              },
              "producedAt": {
                "type": "string",
                "minLength": 20
              },
              "status": {
                "type": "string",
                "enum": [
                  "DRAFT",
                  "FINAL"
                ]
              },
              "commentary": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "notes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "heading": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "heading",
                    "text"
                  ],
                  "additionalProperties": false
                }
              },
              "kpis": {
                "type": "object",
                "properties": {
                  "revenueMonthMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "revenueYtdMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "netIncomeMonthMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "netIncomeYtdMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "cashMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "receivablesMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "payablesMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "dsoDays": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cashMovementMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "burnMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "runwayMonths": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notDerived": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "revenueMonthMinor",
                  "revenueYtdMinor",
                  "netIncomeMonthMinor",
                  "netIncomeYtdMinor",
                  "cashMinor",
                  "receivablesMinor",
                  "payablesMinor",
                  "dsoDays",
                  "cashMovementMinor",
                  "burnMinor",
                  "runwayMonths",
                  "notDerived"
                ],
                "additionalProperties": false
              },
              "balanceSheet": {
                "type": "object",
                "properties": {
                  "asOf": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "sections": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "section": {
                          "type": "string",
                          "enum": [
                            "ASSET",
                            "LIABILITY",
                            "EQUITY"
                          ]
                        },
                        "rows": {
                          "$ref": "#/components/schemas/NonCashLines"
                        },
                        "totalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "section",
                        "rows",
                        "totalMinor"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "balanced": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "asOf",
                  "sections",
                  "balanced"
                ],
                "additionalProperties": false
              },
              "profitAndLoss": {
                "type": "object",
                "properties": {
                  "revenue": {
                    "$ref": "#/components/schemas/Revenue"
                  },
                  "expenses": {
                    "$ref": "#/components/schemas/Revenue"
                  },
                  "totals": {
                    "type": "object",
                    "properties": {
                      "revenueMonthMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "revenueYtdMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "expenseMonthMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "expenseYtdMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "netIncomeMonthMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "netIncomeYtdMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "budgetRevenueMonthMinor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "budgetExpenseMonthMinor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "budgetNetIncomeMonthMinor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "priorYearRevenueMonthMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "priorYearExpenseMonthMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "priorYearNetIncomeMonthMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      }
                    },
                    "required": [
                      "revenueMonthMinor",
                      "revenueYtdMinor",
                      "expenseMonthMinor",
                      "expenseYtdMinor",
                      "netIncomeMonthMinor",
                      "netIncomeYtdMinor",
                      "budgetRevenueMonthMinor",
                      "budgetExpenseMonthMinor",
                      "budgetNetIncomeMonthMinor",
                      "priorYearRevenueMonthMinor",
                      "priorYearExpenseMonthMinor",
                      "priorYearNetIncomeMonthMinor"
                    ],
                    "additionalProperties": false
                  },
                  "budget": {
                    "$ref": "#/components/schemas/Budget"
                  }
                },
                "required": [
                  "revenue",
                  "expenses",
                  "totals",
                  "budget"
                ],
                "additionalProperties": false
              },
              "cashFlow": {
                "type": "object",
                "properties": {
                  "openingCashMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "closingCashMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "netIncomeMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "operatingMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "investingMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "financingMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "unclassifiedMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "cashAccountCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "ties": {
                    "type": "boolean"
                  },
                  "sections": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "enum": [
                            "OPERATING",
                            "INVESTING",
                            "FINANCING"
                          ]
                        },
                        "lines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "accountId": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "amountMinor": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              },
                              "group": {
                                "default": null,
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "NET_INCOME",
                                      "RECLASSIFIED",
                                      "NON_CASH",
                                      "WORKING_CAPITAL"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "accountId",
                              "code",
                              "name",
                              "amountMinor",
                              "group"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "totalMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "name",
                        "lines",
                        "totalMinor"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "openingCashMinor",
                  "closingCashMinor",
                  "netIncomeMinor",
                  "operatingMinor",
                  "investingMinor",
                  "financingMinor",
                  "unclassifiedMinor",
                  "cashAccountCount",
                  "ties",
                  "sections"
                ],
                "additionalProperties": false
              },
              "receivables": {
                "type": "object",
                "properties": {
                  "asOf": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "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": {
                        "default": "0",
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      }
                    },
                    "required": [
                      "current",
                      "d1to30",
                      "d31to60",
                      "d61to90",
                      "over90",
                      "total",
                      "unappliedMinor"
                    ],
                    "additionalProperties": false
                  },
                  "openInvoiceCount": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "controlMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "unexplainedMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "customerCreditReclass": {
                    "$ref": "#/components/schemas/CustomerCreditReclass"
                  },
                  "fxRevaluation": {
                    "$ref": "#/components/schemas/CustomerCreditReclass"
                  },
                  "customers": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "total": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "over90": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        }
                      },
                      "required": [
                        "name",
                        "total",
                        "over90"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "customerCount": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "customerCountTruncated": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "asOf",
                  "totals",
                  "openInvoiceCount",
                  "controlMinor",
                  "unexplainedMinor",
                  "customers",
                  "customerCount",
                  "customerCountTruncated"
                ],
                "additionalProperties": false
              },
              "payables": {
                "default": null,
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "asOf": {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      "currency": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      "totals": {
                        "$ref": "#/components/schemas/FilteredTotalsOption1"
                      },
                      "openBillCount": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "subledgerMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "controlMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "settlementResidualMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "unexplainedMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "controlAccounts": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code",
                            "name"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "vendors": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "total": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "over90": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            "held": {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            }
                          },
                          "required": [
                            "name",
                            "total",
                            "over90",
                            "held"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "vendorCount": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "tied": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "asOf",
                      "currency",
                      "totals",
                      "openBillCount",
                      "subledgerMinor",
                      "controlMinor",
                      "settlementResidualMinor",
                      "unexplainedMinor",
                      "controlAccounts",
                      "vendors",
                      "vendorCount"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "purchasesCommentary": {
                "default": null,
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "commentaryId": {
                        "type": "string"
                      },
                      "periodLabel": {
                        "type": "string"
                      },
                      "readAt": {
                        "type": "string",
                        "minLength": 20
                      },
                      "approvedBy": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      "approvedAt": {
                        "type": "string",
                        "minLength": 20
                      },
                      "approvedNote": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "edited": {
                        "type": "boolean"
                      },
                      "currency": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      "movedChecked": {
                        "type": "boolean"
                      },
                      "movedCount": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "sentences": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "sectionKey": {
                              "type": "string",
                              "enum": [
                                "AGEING",
                                "UNEXPLAINED",
                                "VENDORS",
                                "ACCOUNTS",
                                "EXCEPTIONS"
                              ]
                            },
                            "title": {
                              "type": "string"
                            },
                            "text": {
                              "type": "string"
                            },
                            "basis": {
                              "type": "string",
                              "enum": [
                                "RULE",
                                "MODEL"
                              ]
                            },
                            "edited": {
                              "type": "boolean"
                            },
                            "figures": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "text": {
                                    "type": "string"
                                  },
                                  "subjectLabel": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "movedSinceApproval": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "nowText": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "nowText"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "key",
                                  "label",
                                  "text",
                                  "subjectLabel",
                                  "movedSinceApproval"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "sectionKey",
                            "title",
                            "text",
                            "basis",
                            "edited",
                            "figures"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "commentaryId",
                      "periodLabel",
                      "readAt",
                      "approvedBy",
                      "approvedAt",
                      "approvedNote",
                      "edited",
                      "currency",
                      "movedChecked",
                      "movedCount",
                      "sentences"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "flux": {
                "default": null,
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "noteId": {
                        "type": "string"
                      },
                      "periodLabel": {
                        "type": "string"
                      },
                      "acceptedBy": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      "acceptedAt": {
                        "type": "string",
                        "minLength": 20
                      },
                      "edited": {
                        "type": "boolean"
                      },
                      "factsDigest": {
                        "type": "string"
                      },
                      "blocks": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "accountId": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "text": {
                              "type": "string"
                            },
                            "confidenceBp": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 10000
                            },
                            "entries": {
                              "$ref": "#/components/schemas/Entries"
                            },
                            "movedSinceDraft": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "atDraftMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    },
                                    "nowMinor": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    }
                                  },
                                  "required": [
                                    "atDraftMinor",
                                    "nowMinor"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "accountId",
                            "code",
                            "name",
                            "text",
                            "confidenceBp",
                            "entries",
                            "movedSinceDraft"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "movedCount": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "noteId",
                      "periodLabel",
                      "acceptedBy",
                      "acceptedAt",
                      "edited",
                      "factsDigest",
                      "blocks",
                      "movedCount"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "close": {
                "type": "object",
                "properties": {
                  "started": {
                    "type": "boolean"
                  },
                  "ready": {
                    "type": "boolean"
                  },
                  "done": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "blocked": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "outstanding": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "tasks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "title": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "evidence": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "title",
                        "status",
                        "evidence"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "started",
                  "ready",
                  "done",
                  "blocked",
                  "outstanding",
                  "tasks"
                ],
                "additionalProperties": false
              },
              "certifications": {
                "type": "object",
                "properties": {
                  "bank": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "account": {
                          "type": "string"
                        },
                        "statementBalanceMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "ledgerBalanceMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "differenceMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "certifiedBy": {
                          "type": "string"
                        },
                        "certifiedAt": {
                          "type": "string",
                          "minLength": 20
                        }
                      },
                      "required": [
                        "account",
                        "statementBalanceMinor",
                        "ledgerBalanceMinor",
                        "differenceMinor",
                        "certifiedBy",
                        "certifiedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "accounts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "ledgerBalanceMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "supportBalanceMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "differenceMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "certifiedBy": {
                          "type": "string"
                        },
                        "certifiedAt": {
                          "type": "string",
                          "minLength": 20
                        }
                      },
                      "required": [
                        "code",
                        "name",
                        "ledgerBalanceMinor",
                        "supportBalanceMinor",
                        "differenceMinor",
                        "certifiedBy",
                        "certifiedAt"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "bank",
                  "accounts"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "entity",
              "ledgerName",
              "period",
              "producedAt",
              "status",
              "commentary",
              "notes",
              "kpis",
              "balanceSheet",
              "profitAndLoss",
              "cashFlow",
              "receivables",
              "payables",
              "purchasesCommentary",
              "flux",
              "close",
              "certifications"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "periodYear",
          "periodMonth",
          "periodLabel",
          "status",
          "sha256",
          "fileName",
          "producedBy",
          "producedAt",
          "latest",
          "content"
        ],
        "additionalProperties": false
      },
      "ProfileOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "payrollRemitter": {
            "type": "string",
            "enum": [
              "NONE",
              "QUARTERLY",
              "REGULAR",
              "ACCELERATED_1",
              "ACCELERATED_2"
            ]
          },
          "corporateInstalments": {
            "type": "string",
            "enum": [
              "NONE",
              "MONTHLY",
              "QUARTERLY"
            ]
          },
          "balanceDueMonths": {
            "anyOf": [
              {
                "type": "number",
                "const": 2
              },
              {
                "type": "number",
                "const": 3
              }
            ]
          },
          "issuesT4": {
            "type": "boolean"
          },
          "issuesT4A": {
            "type": "boolean"
          },
          "issuesT5": {
            "type": "boolean"
          },
          "issuesT5018": {
            "type": "boolean"
          },
          "t5018Period": {
            "type": "string",
            "enum": [
              "CALENDAR",
              "FISCAL"
            ]
          },
          "registry": {
            "type": "string",
            "enum": [
              "NONE",
              "FEDERAL",
              "ONTARIO",
              "OTHER"
            ]
          },
          "filesEht": {
            "type": "boolean"
          },
          "ehtInstalments": {
            "type": "boolean"
          },
          "filesWsib": {
            "type": "boolean"
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ]
          },
          "payrollAccountNumber": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]{9}RP[0-9]{4}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "contractAccountNumber": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]{9}RZ[0-9]{4}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "transmitterAccountNumber": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]{9}([A-Z]{2}[0-9]{4})?$"
              },
              {
                "type": "null"
              }
            ]
          },
          "filerName": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "filerAddressLine1": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "filerAddressLine2": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "filerCity": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 28
              },
              {
                "type": "null"
              }
            ]
          },
          "filerRegion": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Z]{2}-[A-Z0-9]{1,3}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "filerPostalCode": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Z0-9 ]{1,10}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "contactName": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 35
              },
              {
                "type": "null"
              }
            ]
          },
          "contactPhone": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]{10}(x[0-9]{1,5})?$"
              },
              {
                "type": "null"
              }
            ]
          },
          "contactEmail": {
            "$ref": "#/components/schemas/ContactEmail"
          },
          "updatedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "updatedAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "payrollRemitter",
          "corporateInstalments",
          "balanceDueMonths",
          "issuesT4",
          "issuesT4A",
          "issuesT5",
          "issuesT5018",
          "t5018Period",
          "registry",
          "filesEht",
          "ehtInstalments",
          "filesWsib",
          "notes",
          "payrollAccountNumber",
          "contractAccountNumber",
          "transmitterAccountNumber",
          "filerName",
          "filerAddressLine1",
          "filerAddressLine2",
          "filerCity",
          "filerRegion",
          "filerPostalCode",
          "contactName",
          "contactPhone",
          "contactEmail",
          "updatedBy",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "ProjectionsItem": {
        "type": "object",
        "properties": {
          "projection": {
            "type": "string",
            "enum": [
              "entity-summary",
              "document-index",
              "webhooks",
              "workflow-trigger"
            ]
          },
          "position": {
            "type": "string",
            "pattern": "^(0|[1-9]\\d{0,18})$"
          },
          "behindBy": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "oldestWaitingAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "lastApplied": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "position": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,18})$"
                  },
                  "label": {
                    "type": "string"
                  },
                  "at": {
                    "type": "string",
                    "minLength": 20
                  }
                },
                "required": [
                  "position",
                  "label",
                  "at"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "held": {
            "$ref": "#/components/schemas/Held"
          },
          "failing": {
            "$ref": "#/components/schemas/Held"
          },
          "lastReplay": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LastReplayOption1"
              },
              {
                "type": "null"
              }
            ]
          },
          "verified": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "at": {
                    "type": "string",
                    "minLength": 20
                  },
                  "drift": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "at",
                  "drift"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "projection",
          "position",
          "behindBy",
          "oldestWaitingAt",
          "lastApplied",
          "held",
          "failing",
          "lastReplay",
          "verified"
        ],
        "additionalProperties": false
      },
      "Proposal": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "entryId": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "amountMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "current": {
                "type": "boolean"
              }
            },
            "required": [
              "entryId",
              "status",
              "amountMinor",
              "current"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "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"
          }
        ]
      },
      "ProposalOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "lineId": {
            "type": "string"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "line": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "theirLabel": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "key",
              "label",
              "theirLabel"
            ],
            "additionalProperties": false
          },
          "pairedLine": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "key": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "key",
                  "label"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "basis": {
            "type": "string",
            "enum": [
              "RULE",
              "MODEL"
            ]
          },
          "cause": {
            "type": "string",
            "enum": [
              "BILL_DATED_ACROSS_MONTH_END",
              "PAYMENT_DATED_ACROSS_MONTH_END",
              "BILL_ONLY_IN_OURS",
              "BILL_NOT_POSTED_HERE",
              "PAYMENT_ONLY_IN_OURS",
              "DUPLICATE_BILL_OURS",
              "SAME_SUPPLIER_OTHER_NAME"
            ]
          },
          "causeLabel": {
            "type": "string"
          },
          "class": {
            "type": "string",
            "enum": [
              "TIMING",
              "CLASSIFICATION",
              "TAX_TREATMENT",
              "MISSING_SOURCE",
              "OUR_DEFECT",
              "THEIR_DEFECT",
              "UNEXPLAINED"
            ]
          },
          "explanation": {
            "type": "string"
          },
          "evidence": {
            "type": "object",
            "properties": {
              "bills": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "billId": {
                      "type": "string"
                    },
                    "number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "billDate": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "postingDate": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "status": {
                      "type": "string"
                    },
                    "amountMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    }
                  },
                  "required": [
                    "billId",
                    "number",
                    "billDate",
                    "postingDate",
                    "status",
                    "amountMinor"
                  ],
                  "additionalProperties": false
                }
              },
              "settlements": {
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "settlementId": {
                      "type": "string"
                    },
                    "billId": {
                      "type": "string"
                    },
                    "billNumber": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "settledOn": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "postingDate": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "amountMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "method": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "settlementId",
                    "billId",
                    "billNumber",
                    "settledOn",
                    "postingDate",
                    "amountMinor",
                    "method"
                  ],
                  "additionalProperties": false
                }
              },
              "names": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "theirs": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "ours": {
                        "type": "string",
                        "maxLength": 120
                      }
                    },
                    "required": [
                      "theirs",
                      "ours"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "window": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Period2"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "amountMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              }
            },
            "required": [
              "bills",
              "settlements",
              "names",
              "window",
              "amountMinor"
            ],
            "additionalProperties": false
          },
          "forDifferenceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "state": {
            "type": "string",
            "enum": [
              "PROPOSED",
              "ACCEPTED",
              "EDITED",
              "DECLINED"
            ]
          },
          "displayState": {
            "type": "string",
            "enum": [
              "WAITING",
              "OUT_OF_DATE",
              "SET_BY_HAND",
              "ACCEPTED",
              "EDITED",
              "DECLINED"
            ]
          },
          "proposedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "proposedAt": {
            "type": "string",
            "minLength": 20
          },
          "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"
              }
            ]
          },
          "finalClass": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "TIMING",
                  "CLASSIFICATION",
                  "TAX_TREATMENT",
                  "MISSING_SOURCE",
                  "OUR_DEFECT",
                  "THEIR_DEFECT",
                  "UNEXPLAINED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "promptVersion": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "lineId",
          "entityTimeZone",
          "line",
          "pairedLine",
          "basis",
          "cause",
          "causeLabel",
          "class",
          "explanation",
          "evidence",
          "forDifferenceMinor",
          "state",
          "displayState",
          "proposedBy",
          "proposedAt",
          "decidedBy",
          "decidedAt",
          "finalClass",
          "promptVersion"
        ],
        "additionalProperties": false
      },
      "Proposals": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/ProposalsItem"
        }
      },
      "ProposalsItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "financialAccountId": {
            "type": "string"
          },
          "shape": {
            "type": "string",
            "enum": [
              "ONE_TO_ONE",
              "ONE_TO_MANY",
              "MANY_TO_ONE",
              "SPLIT"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PROPOSED",
              "ACCEPTED",
              "REJECTED",
              "SUPERSEDED"
            ]
          },
          "scoreBp": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "evidence": {
            "type": "string"
          },
          "signals": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "AMOUNT_EXACT",
                    "AMOUNT_NEAR",
                    "DATE_WINDOW",
                    "COUNTERPARTY",
                    "REFERENCE",
                    "HISTORY"
                  ]
                },
                "scoreBp": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 10000
                },
                "weightBp": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 10000
                },
                "phrase": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "scoreBp",
                "weightBp",
                "phrase"
              ],
              "additionalProperties": false
            }
          },
          "bankLines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Line"
            }
          },
          "candidates": {
            "$ref": "#/components/schemas/Candidates"
          },
          "proposedAt": {
            "type": "string",
            "minLength": 20
          },
          "proposedBy": {
            "type": "string"
          },
          "decidedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "decidedBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "decisionReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "ruleId": {
            "type": [
              "string",
              "null"
            ]
          },
          "expectedClearing": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "paymentRunId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "paymentId": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "runLabel": {
                    "type": "string"
                  },
                  "lineCount": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "amountMinor": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "currency": {
                    "type": "string",
                    "pattern": "^[A-Z]{3}$"
                  },
                  "expectedOn": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "windowFrom": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "windowTo": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "OPEN",
                      "MATCHED",
                      "WITHDRAWN"
                    ]
                  }
                },
                "required": [
                  "id",
                  "paymentRunId",
                  "paymentId",
                  "runLabel",
                  "lineCount",
                  "amountMinor",
                  "currency",
                  "expectedOn",
                  "windowFrom",
                  "windowTo",
                  "status"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "openBills": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "billId": {
                  "type": "string"
                },
                "number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "supplierName": {
                  "type": "string"
                },
                "vendorId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "dueDate": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "openMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "currency": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$"
                },
                "paidBy": {
                  "type": "string",
                  "enum": [
                    "RUN",
                    "CARD",
                    "PAD",
                    "ACCOUNT",
                    "CHEQUE",
                    "WIRE",
                    "ETRANSFER",
                    "OTHER"
                  ]
                }
              },
              "required": [
                "billId",
                "number",
                "supplierName",
                "vendorId",
                "dueDate",
                "openMinor",
                "currency",
                "paidBy"
              ],
              "additionalProperties": false
            }
          },
          "openInvoices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "invoiceId": {
                  "type": "string"
                },
                "number": {
                  "type": "string"
                },
                "customerId": {
                  "type": "string"
                },
                "customerName": {
                  "type": "string"
                },
                "dueDate": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "openMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "currency": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$"
                },
                "evidence": {
                  "type": "string"
                }
              },
              "required": [
                "invoiceId",
                "number",
                "customerId",
                "customerName",
                "dueDate",
                "openMinor",
                "currency",
                "evidence"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "financialAccountId",
          "shape",
          "status",
          "scoreBp",
          "evidence",
          "signals",
          "bankLines",
          "candidates",
          "proposedAt",
          "proposedBy",
          "decidedAt",
          "decidedBy",
          "decisionReason",
          "ruleId",
          "expectedClearing",
          "openBills",
          "openInvoices"
        ],
        "additionalProperties": false
      },
      "ProposedKeys": {
        "maxItems": 11,
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/KeysItem"
        }
      },
      "PurchaseOrderLine": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "orderId": {
                "type": "string"
              },
              "orderNumber": {
                "type": "string"
              },
              "position": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "id",
              "orderId",
              "orderNumber",
              "position"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "QueryLedgerResponse": {
        "type": "object",
        "properties": {
          "columns": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "role": {
                  "type": "string",
                  "enum": [
                    "dimension",
                    "measure",
                    "column"
                  ]
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "id",
                    "text",
                    "date",
                    "instant",
                    "number",
                    "count",
                    "money",
                    "boolean",
                    "json"
                  ]
                },
                "currencyKey": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "key",
                "label",
                "role",
                "type",
                "currencyKey"
              ],
              "additionalProperties": false
            }
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "boolean"
                  },
                  {
                    "type": "null"
                  },
                  {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {},
                    "description": "A json column's value: its shape is the column's, named in columns and in the catalogue's view columns (custom_fields holds a record's custom field values keyed by field key).",
                    "x-open-by-reference": true
                  }
                ]
              }
            }
          },
          "total": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "totalNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "views": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "asOf": {
            "$ref": "#/components/schemas/AsOf"
          },
          "summaryAsOf": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AsOf"
              },
              {
                "type": "null"
              }
            ]
          },
          "runId": {
            "type": "string"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sql": {
            "type": "string"
          }
        },
        "required": [
          "columns",
          "data",
          "total",
          "totalNote",
          "nextCursor",
          "views",
          "asOf",
          "summaryAsOf",
          "runId",
          "notes"
        ],
        "additionalProperties": false
      },
      "Queue": {
        "type": "object",
        "properties": {
          "reviewed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "accepted": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "rejected": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "pending": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "acceptance": {
            "$ref": "#/components/schemas/Acceptance"
          },
          "edited": {
            "$ref": "#/components/schemas/Acceptance"
          },
          "timeToReview": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "medianHours": {
                    "type": "number"
                  },
                  "p90Hours": {
                    "type": "number"
                  },
                  "of": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "medianHours",
                  "p90Hours",
                  "of"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "editedProposals": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "fieldsFrom": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string"
                },
                "changed": {
                  "$ref": "#/components/schemas/AutoCompletedOption1"
                }
              },
              "required": [
                "field",
                "changed"
              ],
              "additionalProperties": false
            }
          },
          "fieldsMore": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "reviewed",
          "accepted",
          "rejected",
          "pending",
          "acceptance",
          "edited",
          "timeToReview",
          "editedProposals",
          "fieldsFrom",
          "fields",
          "fieldsMore"
        ],
        "additionalProperties": false
      },
      "Quote": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "documentId": {
                "type": "string"
              },
              "fileName": {
                "type": "string"
              },
              "promptVersion": {
                "type": "string"
              },
              "linesRead": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "linesKept": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "documentId",
              "fileName",
              "promptVersion",
              "linesRead",
              "linesKept"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Quotes": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "ask": {
              "type": "string",
              "enum": [
                "SEE_WHAT_YOU_HOLD",
                "REMOVE_CONTACT_DETAILS",
                "REMOVE_BANK_ACCOUNT",
                "REMOVE_EVERYTHING",
                "CORRECT_DETAILS",
                "OTHER"
              ]
            },
            "quote": {
              "type": "string"
            }
          },
          "required": [
            "ask",
            "quote"
          ],
          "additionalProperties": false
        }
      },
      "RaiseVendorQueryResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "reference": {
            "type": "string",
            "pattern": "^Q-[0-9A-F]{10}$"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "RESOLVED",
              "SET_ASIDE"
            ]
          },
          "turn": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "US",
                  "SUPPLIER"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "vendor": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "displayName"
            ],
            "additionalProperties": false
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "subject": {
            "$ref": "#/components/schemas/Subject2"
          },
          "origin": {
            "type": "string",
            "enum": [
              "PORTAL",
              "EMAIL",
              "RECORDED",
              "OURS"
            ]
          },
          "raisedAt": {
            "type": "string",
            "minLength": 20
          },
          "lastMessageAt": {
            "type": "string",
            "minLength": 20
          },
          "messageCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "owner": {
            "$ref": "#/components/schemas/Owner"
          },
          "mentionsBanking": {
            "type": "boolean"
          },
          "filedUnder": {
            "$ref": "#/components/schemas/FiledUnder"
          },
          "questionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "followsQueryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "aboutMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "aboutCurrency": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "waitingSince": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "closedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "sentence": {
            "type": "string"
          },
          "draftPausedUntil": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "raisedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "arrival": {
            "$ref": "#/components/schemas/Arrival"
          },
          "linkIssuer": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "closure": {
            "$ref": "#/components/schemas/Closure"
          },
          "follows": {
            "$ref": "#/components/schemas/Follows"
          },
          "blocked": {
            "$ref": "#/components/schemas/Blocked"
          },
          "answerableBy": {
            "$ref": "#/components/schemas/AnswerableBy"
          }
        },
        "required": [
          "id",
          "reference",
          "title",
          "status",
          "turn",
          "vendor",
          "entityId",
          "entityName",
          "entityTimeZone",
          "subject",
          "origin",
          "raisedAt",
          "lastMessageAt",
          "messageCount",
          "owner",
          "mentionsBanking",
          "filedUnder",
          "questionId",
          "followsQueryId",
          "aboutMinor",
          "aboutCurrency",
          "waitingSince",
          "closedAt",
          "sentence",
          "draftPausedUntil",
          "raisedBy",
          "arrival",
          "linkIssuer",
          "closure",
          "follows",
          "blocked",
          "answerableBy"
        ],
        "additionalProperties": false
      },
      "RatesItem": {
        "type": "object",
        "properties": {
          "bucket": {
            "type": "string",
            "enum": [
              "CURRENT",
              "D1_TO_30",
              "D31_TO_60",
              "D61_TO_90",
              "OVER_90"
            ]
          },
          "basisPoints": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          }
        },
        "required": [
          "bucket",
          "basisPoints"
        ],
        "additionalProperties": false
      },
      "Read": {
        "type": "string",
        "enum": [
          "syncQboCustomers",
          "syncQboVendors",
          "syncQboOpenPayables",
          "syncXeroCustomers",
          "syncXeroVendors",
          "syncXeroOpenPayables",
          "syncStripeCustomers",
          "syncHubSpotCrm",
          "syncSalesforceContracts"
        ]
      },
      "ReadMonthEndCommentaryResponse": {
        "type": "object",
        "properties": {
          "commentary": {
            "$ref": "#/components/schemas/Commentary"
          },
          "sections": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "enum": [
                    "AGEING",
                    "UNEXPLAINED",
                    "VENDORS",
                    "ACCOUNTS",
                    "EXCEPTIONS"
                  ]
                },
                "ordinal": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 5
                },
                "title": {
                  "type": "string"
                },
                "figures": {
                  "maxItems": 14,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "key": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      },
                      "kind": {
                        "type": "string",
                        "enum": [
                          "MONEY",
                          "COUNT"
                        ]
                      },
                      "text": {
                        "type": "string"
                      },
                      "valueMinor": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "valueCount": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "currency": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^[A-Z]{3}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "source": {
                        "type": "string"
                      },
                      "subject": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "VENDOR",
                                  "ACCOUNT"
                                ]
                              },
                              "id": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "id",
                              "label"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "key",
                      "label",
                      "kind",
                      "text",
                      "valueMinor",
                      "valueCount",
                      "currency",
                      "source",
                      "subject"
                    ],
                    "additionalProperties": false
                  }
                },
                "sentences": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "basis": {
                        "type": "string",
                        "enum": [
                          "RULE",
                          "MODEL"
                        ]
                      },
                      "text": {
                        "type": "string"
                      },
                      "citedKeys": {
                        "minItems": 1,
                        "maxItems": 4,
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "PROPOSED",
                          "KEPT",
                          "EDITED",
                          "LEFT_OUT",
                          "SET_ASIDE"
                        ]
                      },
                      "finalText": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "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"
                          }
                        ]
                      },
                      "promptVersion": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "basis",
                      "text",
                      "citedKeys",
                      "state",
                      "finalText",
                      "decidedBy",
                      "decidedAt",
                      "promptVersion"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "key",
                "ordinal",
                "title",
                "figures",
                "sentences"
              ],
              "additionalProperties": false
            }
          },
          "lateEntryCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "assistant": {
            "type": "object",
            "properties": {
              "attempts": {
                "type": "integer",
                "minimum": 0,
                "maximum": 3
              },
              "remaining": {
                "type": "integer",
                "minimum": 0,
                "maximum": 3
              },
              "modelStopped": {
                "type": "boolean"
              },
              "history": {
                "type": "object",
                "properties": {
                  "kept": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "edited": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "leftOut": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kept",
                  "edited",
                  "leftOut"
                ],
                "additionalProperties": false
              },
              "leftOutSections": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "AGEING",
                    "UNEXPLAINED",
                    "VENDORS",
                    "ACCOUNTS",
                    "EXCEPTIONS"
                  ]
                }
              }
            },
            "required": [
              "attempts",
              "remaining",
              "modelStopped",
              "history",
              "leftOutSections"
            ],
            "additionalProperties": false
          },
          "packs": {
            "maxItems": 5,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "producedAt": {
                  "type": "string",
                  "minLength": 20
                },
                "status": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "producedAt",
                "status"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "commentary",
          "sections",
          "lateEntryCount",
          "assistant",
          "packs"
        ],
        "additionalProperties": false
      },
      "Reading": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "verdict": {
                "type": "string",
                "enum": [
                  "SAME",
                  "DIFFERENT",
                  "UNSURE"
                ]
              },
              "quote": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "note": {
                "type": "string",
                "maxLength": 160
              },
              "promptVersion": {
                "type": "string"
              },
              "readBy": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "readAt": {
                "type": "string",
                "minLength": 20
              }
            },
            "required": [
              "verdict",
              "quote",
              "note",
              "promptVersion",
              "readBy",
              "readAt"
            ],
            "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"
          }
        ]
      },
      "Reading3": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "verdict": {
                "type": "string",
                "enum": [
                  "BILL",
                  "CORRESPONDENCE"
                ]
              },
              "decidedBy": {
                "type": "string",
                "enum": [
                  "RULE",
                  "MODEL",
                  "FALLBACK"
                ]
              },
              "reasonCode": {
                "type": "string",
                "enum": [
                  "NO_AMOUNT_NO_NUMBER",
                  "REPLY_WITHOUT_FIGURES",
                  "AMOUNT_AND_NUMBER",
                  "SENDER_READ_AS_BILL_BEFORE",
                  "READER_STOPPED_ON_THESE_BOOKS",
                  "INVOICE",
                  "PAYMENT_QUESTION",
                  "PAYMENT_REMINDER",
                  "STATEMENT",
                  "NOTICE",
                  "OTHER_MESSAGE",
                  "MODEL_REFUSED",
                  "MODEL_UNPARSABLE",
                  "MODEL_UNAVAILABLE",
                  "QUOTE_NOT_IN_TEXT",
                  "BUDGET",
                  "DISCLOSURE"
                ]
              },
              "sentence": {
                "type": "string"
              }
            },
            "required": [
              "verdict",
              "decidedBy",
              "reasonCode",
              "sentence"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Reason": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "REPLIES_OFF",
              "REPLIES_EXPIRED",
              "NO_CONTACT",
              "OUTBOUND_NOT_APPROVED",
              "RELAY_REFUSED",
              "PERSON_DRAFTED",
              "NO_SENDER",
              "OWN_DOMAIN",
              "AUTO_SUBMITTED",
              "UNAUTHENTICATED_STRANGER",
              "RECIPIENT_STOPPED",
              "RECIPIENT_BOUNCED",
              "FOLDED_INTO_DIGEST",
              "LEDGER_DAILY_CAP",
              "DISCARDED",
              "TEST_COPY_HELD"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "Reason2": {
        "type": "string",
        "enum": [
          "REVOKED",
          "NO_CAUSATION_USER",
          "TOO_LARGE",
          "NOT_A_MESSAGE",
          "MULTIPART_WITHOUT_BOUNDARY",
          "TOO_DEEP",
          "TOO_MANY_PARTS",
          "NO_RECEIVABLE_ACCOUNT",
          "OVER_DAILY_LIMIT",
          "UNKNOWN_LOCAL_PART"
        ]
      },
      "Receipt": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "purchaseOrderId": {
            "type": "string"
          },
          "orderNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "sequence": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "string",
            "enum": [
              "PROPOSED",
              "CONFIRMED",
              "VOID",
              "DISCARDED"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "MANUAL",
              "SLIP_READ",
              "SLIP_MAILED"
            ]
          },
          "entity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "entityTimeZone": {
            "type": "string"
          },
          "receivedOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "receivedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "onBehalfOf": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "lineCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "attachmentCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "proposedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "voided": {
            "$ref": "#/components/schemas/Retired"
          },
          "discarded": {
            "$ref": "#/components/schemas/Retired"
          },
          "signedForBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "purchaseOrderLineId": {
                  "type": "string"
                },
                "position": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "description": {
                  "type": "string"
                },
                "supplyCategory": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "GOODS",
                        "SERVICES",
                        "INTANGIBLE_PROPERTY",
                        "REAL_PROPERTY"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "quantity": {
                  "type": "string",
                  "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                },
                "ordered": {
                  "type": "string",
                  "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                },
                "slipQuantity": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{1,10}(\\.\\d{1,4})?$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "slipDescription": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "customFields": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "type": [
                      "string",
                      "boolean"
                    ]
                  }
                },
                "carriedFrom": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "purchaseOrderLineId",
                "position",
                "description",
                "supplyCategory",
                "quantity",
                "ordered",
                "slipQuantity",
                "slipDescription",
                "note"
              ],
              "additionalProperties": false
            }
          },
          "evidence": {
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "documentId": {
                  "type": "string"
                },
                "fileName": {
                  "type": "string"
                },
                "mimeType": {
                  "type": "string"
                },
                "caption": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "isImage": {
                  "type": "boolean"
                },
                "addedBy": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name"
                  ],
                  "additionalProperties": false
                },
                "addedAt": {
                  "type": "string",
                  "minLength": 20
                },
                "withdrawn": {
                  "$ref": "#/components/schemas/Retired"
                }
              },
              "required": [
                "id",
                "documentId",
                "fileName",
                "mimeType",
                "caption",
                "isImage",
                "addedBy",
                "addedAt",
                "withdrawn"
              ],
              "additionalProperties": false
            }
          },
          "separation": {
            "type": "object",
            "properties": {
              "applied": {
                "type": "boolean"
              },
              "approver": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "applied",
              "approver"
            ],
            "additionalProperties": false
          },
          "overPercentApplied": {
            "type": "string"
          },
          "proposal": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "promptVersion": {
                    "type": "string"
                  },
                  "linesRead": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "linesKept": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "arrival": {
                    "type": "object",
                    "properties": {
                      "inboundEmailId": {
                        "type": "string"
                      },
                      "senderDomain": {
                        "type": "string"
                      },
                      "authentication": {
                        "type": "string",
                        "enum": [
                          "PASSED",
                          "FAILED",
                          "UNRECORDED"
                        ]
                      },
                      "domainKnown": {
                        "type": "boolean"
                      },
                      "warnings": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "inboundEmailId",
                      "senderDomain",
                      "authentication",
                      "domainKnown",
                      "warnings"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "promptVersion",
                  "linesRead",
                  "linesKept",
                  "arrival"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "counts": {
            "type": "object",
            "properties": {
              "audit": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "audit"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "purchaseOrderId",
          "orderNumber",
          "sequence",
          "status",
          "source",
          "entity",
          "entityTimeZone",
          "receivedOn",
          "receivedBy",
          "onBehalfOf",
          "lineCount",
          "attachmentCount",
          "proposedAt",
          "voided",
          "discarded",
          "signedForBy",
          "note",
          "lines",
          "evidence",
          "separation",
          "overPercentApplied",
          "proposal",
          "counts"
        ],
        "additionalProperties": false
      },
      "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
      },
      "Recipients": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/RecipientsItem"
        }
      },
      "Recipients2": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "email": {
              "type": "string"
            },
            "role": {
              "type": "string",
              "enum": [
                "BILLING",
                "CC",
                "ESCALATION"
              ]
            }
          },
          "required": [
            "email",
            "role"
          ],
          "additionalProperties": false
        }
      },
      "RecipientsItem": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "role": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "BILLING",
                  "ACCOUNT_MANAGER",
                  "ESCALATION",
                  "REMITTANCE"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "VENDOR",
              "CONTACT"
            ]
          }
        },
        "required": [
          "email",
          "name",
          "role",
          "source"
        ],
        "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
          }
        ]
      },
      "RecordBillFxRateResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "DRAFT",
              "IN_REVIEW",
              "APPROVED",
              "PARTIALLY_PAID",
              "PAID",
              "VOID"
            ]
          },
          "versionCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "findings": {
            "$ref": "#/components/schemas/Findings2"
          }
        },
        "required": [
          "id",
          "status",
          "versionCount",
          "findings"
        ],
        "additionalProperties": false
      },
      "RecordGoodsReceiptResponse": {
        "type": "object",
        "properties": {
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          },
          "order": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "DRAFT",
                  "IN_APPROVAL",
                  "APPROVED",
                  "SENT",
                  "PART_RECEIVED",
                  "RECEIVED",
                  "CLOSED",
                  "CANCELLED"
                ]
              },
              "receiving": {
                "type": "object",
                "properties": {
                  "state": {
                    "type": "string",
                    "enum": [
                      "NONE",
                      "PART",
                      "COMPLETE"
                    ]
                  },
                  "receivedLines": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "lineCount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "proposed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "state",
                  "receivedLines",
                  "lineCount",
                  "proposed"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "status",
              "receiving"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "receipt",
          "order"
        ],
        "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
      },
      "Reference": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "target": {
                "type": "string",
                "enum": [
                  "CUSTOMER",
                  "VENDOR",
                  "PRODUCT",
                  "CONTRACT",
                  "ACCOUNT",
                  "ENTITY",
                  "PERSON",
                  "DIMENSION_VALUE",
                  "CUSTOM_RECORD"
                ]
              },
              "objectKey": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "dimensionCode": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "target",
              "objectKey",
              "dimensionCode"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Refusal": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "remedy": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message",
              "remedy"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Refused": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "invoiceId": {
              "type": "string"
            },
            "number": {
              "type": "string"
            },
            "reason": {
              "type": "string"
            }
          },
          "required": [
            "invoiceId",
            "number",
            "reason"
          ],
          "additionalProperties": false
        }
      },
      "RegisterAssetRequest": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string",
            "minLength": 1
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 1000
          },
          "acquiredOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "inServiceOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "costMajor": {
            "type": "string",
            "pattern": "^\\d+(\\.\\d{1,2})?$"
          },
          "salvageMajor": {
            "default": "0",
            "type": "string",
            "pattern": "^\\d+(\\.\\d{1,2})?$"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "method": {
            "type": "string",
            "enum": [
              "STRAIGHT_LINE",
              "DECLINING_BALANCE"
            ]
          },
          "usefulLifeMonths": {
            "type": "integer",
            "minimum": 1,
            "maximum": 600
          },
          "decliningRatePct": {
            "type": "string",
            "pattern": "^\\d{1,3}(\\.\\d{1,3})?$"
          },
          "ccaClass": {
            "type": "string",
            "enum": [
              "1",
              "3",
              "6",
              "8",
              "10",
              "12",
              "16",
              "43",
              "44",
              "46",
              "50",
              "53",
              "54",
              "55",
              "56",
              "10.1",
              "14.1",
              "43.1",
              "43.2"
            ]
          },
          "isPassengerVehicle": {
            "type": "boolean"
          },
          "assetAccountId": {
            "type": "string",
            "minLength": 1
          },
          "accumulatedAccountId": {
            "type": "string",
            "minLength": 1
          },
          "expenseAccountId": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "entityId",
          "name",
          "acquiredOn",
          "inServiceOn",
          "costMajor",
          "currency",
          "method",
          "usefulLifeMonths",
          "assetAccountId",
          "accumulatedAccountId",
          "expenseAccountId"
        ],
        "additionalProperties": false
      },
      "RegisterAssetResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "acquiredOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "inServiceOn": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "costMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "salvageMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "currency": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "enum": [
              "STRAIGHT_LINE",
              "DECLINING_BALANCE"
            ]
          },
          "usefulLifeMonths": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "decliningRateE5": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "ccaClass": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "1",
                  "3",
                  "6",
                  "8",
                  "10",
                  "12",
                  "16",
                  "43",
                  "44",
                  "46",
                  "50",
                  "53",
                  "54",
                  "55",
                  "56",
                  "10.1",
                  "14.1",
                  "43.1",
                  "43.2"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "$ref": "#/components/schemas/Source"
          },
          "isPassengerVehicle": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "DISPOSED",
              "FULLY_DEPRECIATED"
            ]
          },
          "disposedOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "disposalProceedsMinor": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "disposalEntryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "disposalEntryStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "disposalBinds": {
            "type": "boolean"
          },
          "accumulatedPostedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "netBookValueMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "pendingRows": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "assetAccount": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "code",
              "name"
            ],
            "additionalProperties": false
          },
          "accumulatedAccount": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "code",
              "name"
            ],
            "additionalProperties": false
          },
          "expenseAccount": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "code",
              "name"
            ],
            "additionalProperties": false
          },
          "createdByName": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "schedule": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "periodYear": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "periodMonth": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 12
                },
                "periodLabel": {
                  "type": "string"
                },
                "amountMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "entryId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "entryNumber": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "entryStatus": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "handedToQueueAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 20
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "periodYear",
                "periodMonth",
                "periodLabel",
                "amountMinor",
                "entryId",
                "entryNumber",
                "entryStatus",
                "handedToQueueAt"
              ],
              "additionalProperties": false
            }
          },
          "scheduleTotalMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "cca": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fiscalYear": {
                  "$ref": "#/components/schemas/Window"
                },
                "row": {
                  "type": "object",
                  "properties": {
                    "ccaClass": {
                      "type": "string",
                      "enum": [
                        "1",
                        "3",
                        "6",
                        "8",
                        "10",
                        "12",
                        "16",
                        "43",
                        "44",
                        "46",
                        "50",
                        "53",
                        "54",
                        "55",
                        "56",
                        "10.1",
                        "14.1",
                        "43.1",
                        "43.2"
                      ]
                    },
                    "assetId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "assetName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "rateE5": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "openingUccMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "additionsMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "dispositionsMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "regime": {
                      "type": "string",
                      "enum": [
                        "HALF_YEAR",
                        "AII_PHASE_1",
                        "AII_PHASE_OUT",
                        "AII_REINSTATED_2025",
                        "AII_REINSTATED_NIL",
                        "CLEAN_ENERGY_FULL_EXPENSING",
                        "MANUFACTURING_FULL_EXPENSING",
                        "PRODUCTIVITY_ASSETS",
                        "ZERO_EMISSION_ENHANCED",
                        "NONE"
                      ]
                    },
                    "adjustmentMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "baseMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "ccaMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "closingUccMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "recaptureMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "terminalLossMinor": {
                      "type": "string",
                      "pattern": "^-?\\d+$"
                    },
                    "dispositionsNotPostedCount": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "ccaClass",
                    "assetId",
                    "assetName",
                    "rateE5",
                    "openingUccMinor",
                    "additionsMinor",
                    "dispositionsMinor",
                    "regime",
                    "adjustmentMinor",
                    "baseMinor",
                    "ccaMinor",
                    "closingUccMinor",
                    "recaptureMinor",
                    "terminalLossMinor",
                    "dispositionsNotPostedCount",
                    "notes"
                  ],
                  "additionalProperties": false
                },
                "bookDepreciationMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "bookVsTaxMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                }
              },
              "required": [
                "fiscalYear",
                "row",
                "bookDepreciationMinor",
                "bookVsTaxMinor"
              ],
              "additionalProperties": false
            }
          },
          "ccaRefusal": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "assetId": {
                    "type": "string"
                  },
                  "assetName": {
                    "type": "string"
                  },
                  "ccaClass": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string"
                  },
                  "remedy": {
                    "type": "string"
                  }
                },
                "required": [
                  "assetId",
                  "assetName",
                  "ccaClass",
                  "reason",
                  "remedy"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "name",
          "description",
          "acquiredOn",
          "inServiceOn",
          "costMinor",
          "salvageMinor",
          "currency",
          "method",
          "usefulLifeMonths",
          "decliningRateE5",
          "ccaClass",
          "source",
          "isPassengerVehicle",
          "status",
          "disposedOn",
          "disposalProceedsMinor",
          "disposalEntryId",
          "disposalEntryStatus",
          "disposalBinds",
          "accumulatedPostedMinor",
          "netBookValueMinor",
          "pendingRows",
          "assetAccount",
          "accumulatedAccount",
          "expenseAccount",
          "createdByName",
          "createdAt",
          "schedule",
          "scheduleTotalMinor",
          "cca",
          "ccaRefusal"
        ],
        "additionalProperties": false
      },
      "RegisterBillAssetResponse": {
        "type": "object",
        "properties": {
          "asset": {
            "$ref": "#/components/schemas/RegisterAssetResponse"
          },
          "line": {
            "$ref": "#/components/schemas/LineOption1"
          }
        },
        "required": [
          "asset",
          "line"
        ],
        "additionalProperties": false
      },
      "Replaces": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "billId": {
                "type": "string"
              },
              "supplierName": {
                "type": "string"
              },
              "number": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "billDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "status": {
                "type": "string",
                "enum": [
                  "DRAFT",
                  "IN_REVIEW",
                  "DECLINED",
                  "APPROVED",
                  "HELD",
                  "OPEN",
                  "DUE",
                  "OVERDUE",
                  "IN_RUN",
                  "PARTIALLY_PAID",
                  "PAID",
                  "VOID"
                ]
              },
              "totalMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "linkedBy": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "linkedAt": {
                "type": "string",
                "minLength": 20
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "voidedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 20
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "voidReason": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "billId",
              "supplierName",
              "number",
              "billDate",
              "status",
              "totalMinor",
              "currency",
              "linkedBy",
              "linkedAt",
              "note",
              "voidedAt",
              "voidReason"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Replies": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "enabledBy": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "enabledAt": {
                "type": "string",
                "minLength": 20
              },
              "expiresAt": {
                "type": "string",
                "minLength": 20
              },
              "inForce": {
                "type": "boolean"
              }
            },
            "required": [
              "enabledBy",
              "enabledAt",
              "expiresAt",
              "inForce"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Report": {
        "type": "string",
        "enum": [
          "spend-by-vendor",
          "spend-by-account",
          "spend-by-month",
          "spend-by-company",
          "spend-by-dimension",
          "bill-register",
          "payment-register",
          "tax-paid",
          "cash-required",
          "itc-at-risk",
          "unexplained-payable",
          "subsequent-payments",
          "slip-reconciliation",
          "approvals",
          "own-work-approvals",
          "open-commitments",
          "prepaid-schedule",
          "cut-off",
          "holdbacks-held"
        ]
      },
      "RequestFullExportResponse": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/RequestFullExportResponseOption1"
          },
          {
            "$ref": "#/components/schemas/UndoAgentBatchResponse"
          }
        ]
      },
      "RequestFullExportResponseOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "WAITING",
              "APPROVED",
              "DOWNLOADED",
              "DECLINED",
              "WITHDRAWN",
              "EXPIRED",
              "CANCELLED"
            ]
          },
          "path": {
            "type": "string",
            "enum": [
              "TWO_PERSON",
              "SOLE_ADMIN_OWNER_OVERRIDE"
            ]
          },
          "includeBankFiles": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          },
          "requestedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "requestedAt": {
            "type": "string"
          },
          "decideBy": {
            "type": "string"
          },
          "approvedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "approvedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "approvalNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "declinedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "declinedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "declineReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "withdrawnAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiredAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiredStage": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "DECISION",
                  "DOWNLOAD"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "downloadBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "downloadedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "overrideCapacity": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "OWN_ORGANIZATION",
                  "MANAGING_FIRM"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "overrideReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "facts": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "requesterSeatSince": {
                    "type": "string"
                  },
                  "earlierRequests": {
                    "type": "object",
                    "properties": {
                      "downloaded": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "declined": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "expired": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "downloaded",
                      "declined",
                      "expired"
                    ],
                    "additionalProperties": false
                  },
                  "lastDecline": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "byName": {
                            "type": "string"
                          },
                          "on": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "byName",
                          "on",
                          "reason"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lastDownload": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "byName": {
                            "type": "string"
                          },
                          "on": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "byName",
                          "on"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reasonAddressesApprover": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "requesterSeatSince",
                  "earlierRequests",
                  "lastDecline",
                  "lastDownload",
                  "reasonAddressesApprover"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "job": {
            "$ref": "#/components/schemas/Job2"
          },
          "entityTimeZone": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "state",
          "path",
          "includeBankFiles",
          "reason",
          "requestedBy",
          "requestedAt",
          "decideBy",
          "approvedBy",
          "approvedAt",
          "approvalNote",
          "declinedBy",
          "declinedAt",
          "declineReason",
          "withdrawnAt",
          "expiredAt",
          "expiredStage",
          "downloadBy",
          "downloadedAt",
          "overrideCapacity",
          "overrideReason",
          "facts",
          "job",
          "entityTimeZone"
        ],
        "additionalProperties": false
      },
      "RequestPurchasesExportResponseOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "BILLS",
              "VENDORS",
              "PAYMENT_RUNS"
            ]
          },
          "format": {
            "type": "string",
            "enum": [
              "CSV",
              "XLSX"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "QUEUED",
              "RUNNING",
              "READY",
              "FAILED",
              "EXPIRED"
            ]
          },
          "filters": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "query": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "requestedBy": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "requestedAt": {
            "type": "string",
            "minLength": 20
          },
          "startedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "finishedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "totalRows": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "rowCount": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "byteSize": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "fileName": {
            "type": [
              "string",
              "null"
            ]
          },
          "sha256": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "availableUntil": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "failureKind": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "REFUSED",
                  "TOO_SLOW",
                  "STALE",
                  "FAULT"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "failureReason": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ]
          },
          "notify": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "SENT",
                  "UNDELIVERABLE"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "attempt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "jobId": {
            "type": [
              "string",
              "null"
            ]
          },
          "entityTimeZone": {
            "type": "string"
          },
          "clockEntityName": {
            "type": [
              "string",
              "null"
            ]
          },
          "seatCompanyNames": {
            "anyOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "mine": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "kind",
          "format",
          "state",
          "filters",
          "query",
          "requestedBy",
          "requestedAt",
          "startedAt",
          "finishedAt",
          "totalRows",
          "rowCount",
          "byteSize",
          "fileName",
          "sha256",
          "availableUntil",
          "failureKind",
          "failureReason",
          "notify",
          "attempt",
          "jobId",
          "entityTimeZone",
          "clockEntityName",
          "seatCompanyNames",
          "mine"
        ],
        "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
      },
      "RequestTestCopyRequest": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "make",
              "refresh"
            ]
          },
          "maskContacts": {
            "type": "boolean"
          },
          "soleAdministrator": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string",
                "minLength": 10,
                "maxLength": 500
              }
            },
            "required": [
              "reason"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "mode"
        ],
        "additionalProperties": false
      },
      "RetireVendorSenderDomainResponse": {
        "type": "object",
        "properties": {
          "senderDomain": {
            "$ref": "#/components/schemas/ListVendorSenderDomainsResponseItem"
          }
        },
        "required": [
          "senderDomain"
        ],
        "additionalProperties": false
      },
      "Retired": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "by": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "at": {
                "type": "string",
                "minLength": 20
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "by",
              "at",
              "reason"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Retired2": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "byName": {
                "type": "string"
              },
              "at": {
                "type": "string",
                "minLength": 20
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "byName",
              "at",
              "reason"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Revenue": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "accountId": {
              "type": "string"
            },
            "code": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "monthMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "ytdMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            },
            "budgetMonthMinor": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "priorYearMonthMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          "required": [
            "accountId",
            "code",
            "name",
            "monthMinor",
            "ytdMinor",
            "budgetMonthMinor",
            "priorYearMonthMinor"
          ],
          "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
        }
      },
      "Rows2": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "rowKind": {
                  "type": "string",
                  "enum": [
                    "THEIRS",
                    "OURS_ONLY"
                  ]
                },
                "lineId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "lineNo": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "lineKind": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "INVOICE",
                        "CREDIT",
                        "PAYMENT",
                        "OTHER"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "matchKind": {
                  "type": "string",
                  "enum": [
                    "BOTH",
                    "AMOUNT_DIFFERS",
                    "ONLY_THEIRS",
                    "ONLY_OURS"
                  ]
                },
                "matchRule": {
                  "type": "string",
                  "enum": [
                    "NUMBER_AND_AMOUNT",
                    "NUMBER_ONLY",
                    "PAYMENT_REFERENCE",
                    "PAYMENT_AMOUNT_AND_DATE",
                    "PERSON",
                    "NONE"
                  ]
                },
                "matchedBy": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "RULE",
                        "PERSON"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "theirs": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "reference": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "docDate": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "amountMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "taxMinor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "excerpt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "page": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "figureSource": {
                          "type": "string",
                          "enum": [
                            "PAGE_CHECKED",
                            "PAGE_NOT_FOUND",
                            "FILE_CELL",
                            "PERSON"
                          ]
                        }
                      },
                      "required": [
                        "reference",
                        "docDate",
                        "amountMinor",
                        "taxMinor",
                        "excerpt",
                        "page",
                        "figureSource"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "ours": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "BILL",
                            "CREDIT",
                            "PAYMENT"
                          ]
                        },
                        "id": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        },
                        "date": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "keyedOn": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "amountMinor": {
                          "type": "string",
                          "pattern": "^-?\\d+$"
                        },
                        "status": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "id",
                        "number",
                        "date",
                        "keyedOn",
                        "amountMinor",
                        "status"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "differenceMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "differenceHint": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "TAX",
                        "ROUNDING",
                        "PART_PAYMENT",
                        "PAID",
                        "OTHER"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "evidence": {
                  "type": "string"
                },
                "suggestion": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "billId": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        },
                        "why": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "billId",
                        "number",
                        "why"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "consequence": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "periodState": {
                          "type": "string",
                          "enum": [
                            "FILED",
                            "NOT_FILED",
                            "NO_REGISTRATION",
                            "NO_DATE",
                            "FOREIGN"
                          ]
                        },
                        "returnPeriod": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "start": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                },
                                "end": {
                                  "type": "string",
                                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                                }
                              },
                              "required": [
                                "start",
                                "end"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "filedOn": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "windowYears": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "windowLastDay": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "windowOpen": {
                          "type": "boolean"
                        },
                        "printedTaxMinor": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?\\d+$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "unbooked": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "billId": {
                                  "type": "string"
                                },
                                "number": {
                                  "type": "string"
                                },
                                "status": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "billId",
                                "number",
                                "status"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "sentence": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "periodState",
                        "returnPeriod",
                        "filedOn",
                        "windowYears",
                        "windowLastDay",
                        "windowOpen",
                        "printedTaxMinor",
                        "unbooked",
                        "sentence"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "declined": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "on": {
                          "type": "string",
                          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                        },
                        "byName": {
                          "type": "string"
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "on",
                        "byName",
                        "reason"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "changedSinceYouLooked": {
                  "type": "boolean"
                }
              },
              "required": [
                "key",
                "rowKind",
                "lineId",
                "lineNo",
                "lineKind",
                "matchKind",
                "matchRule",
                "matchedBy",
                "theirs",
                "ours",
                "differenceMinor",
                "differenceHint",
                "evidence",
                "suggestion",
                "consequence",
                "declined"
              ],
              "additionalProperties": false
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "counts": {
            "$ref": "#/components/schemas/Counts4"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "reconciliationDigest": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        },
        "required": [
          "data",
          "nextCursor",
          "total",
          "counts",
          "entityTimeZone",
          "reconciliationDigest"
        ],
        "additionalProperties": false
      },
      "Rows3": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/TieOption1"
        }
      },
      "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
      },
      "RowsItem2": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "lineNumber": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          },
          "cells": {
            "$ref": "#/components/schemas/Cells2"
          },
          "edits": {
            "$ref": "#/components/schemas/Cells2"
          },
          "values": {
            "$ref": "#/components/schemas/Cells2"
          },
          "confidenceBp": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^(?:[a-z][A-Za-z0-9]*|cf\\.[a-z][a-z0-9_]{0,39}|line\\.[a-z][a-z0-9_]{0,39})$"
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000
            }
          },
          "problems": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64,
                      "pattern": "^(?:[a-z][A-Za-z0-9]*|cf\\.[a-z][a-z0-9_]{0,39}|line\\.[a-z][a-z0-9_]{0,39})$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "message": {
                  "type": "string",
                  "maxLength": 1000
                },
                "group": {
                  "type": "boolean"
                }
              },
              "required": [
                "field",
                "message"
              ],
              "additionalProperties": false
            }
          },
          "hasProblem": {
            "type": "boolean"
          },
          "lowConfidence": {
            "type": "boolean"
          },
          "recordId": {
            "type": [
              "string",
              "null"
            ]
          },
          "refusal": {
            "type": [
              "string",
              "null"
            ]
          },
          "groupKey": {
            "default": null,
            "type": [
              "string",
              "null"
            ]
          },
          "groupLine": {
            "default": null,
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "intake": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "vendor": {
                    "type": "object",
                    "properties": {
                      "state": {
                        "type": "string",
                        "enum": [
                          "MATCHED",
                          "NONE",
                          "AMBIGUOUS",
                          "ARCHIVED"
                        ]
                      },
                      "id": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "displayName": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "state",
                      "id",
                      "displayName"
                    ],
                    "additionalProperties": false
                  },
                  "paper": {
                    "type": "object",
                    "properties": {
                      "state": {
                        "type": "string",
                        "enum": [
                          "ATTACHED",
                          "NONE",
                          "NAMED_BUT_MISSING",
                          "AMBIGUOUS"
                        ]
                      },
                      "by": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "CELL",
                              "NAME"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "documentId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "attachmentId": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "fileName": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "mimeType": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "state",
                      "by",
                      "documentId",
                      "attachmentId",
                      "fileName",
                      "mimeType"
                    ],
                    "additionalProperties": false
                  },
                  "checkState": {
                    "type": "string",
                    "enum": [
                      "NOT_ASKED",
                      "WAITING",
                      "READ",
                      "NOT_READ",
                      "STALE"
                    ]
                  },
                  "check": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "runId": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "minLength": 20
                          },
                          "verdict": {
                            "type": "string",
                            "enum": [
                              "READ",
                              "NOT_READ"
                            ]
                          },
                          "notReadWhy": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "NO_EVIDENCE",
                                  "UNREADABLE",
                                  "DISCLOSURE",
                                  "BUDGET",
                                  "PROVIDER",
                                  "UNPARSABLE",
                                  "REFUSED"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "documentKind": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "VOID_CHEQUE",
                                  "BANK_LETTER",
                                  "STATEMENT",
                                  "OTHER"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "legible": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          },
                          "namesTheSupplier": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          },
                          "holderNamePrinted": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 200
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "routing": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "AGREES",
                                  "DIFFERS",
                                  "NOT_FOUND"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "holderVsFile": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "AGREES",
                                  "DIFFERS",
                                  "NOT_FOUND"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "holderVsSupplier": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "AGREES",
                                  "DIFFERS",
                                  "NOT_FOUND"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "printedAccountLast4": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^\\d{4}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "promptVersion": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "runId",
                          "createdAt",
                          "verdict",
                          "notReadWhy",
                          "documentKind",
                          "legible",
                          "namesTheSupplier",
                          "holderNamePrinted",
                          "routing",
                          "holderVsFile",
                          "holderVsSupplier",
                          "printedAccountLast4",
                          "promptVersion"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "notes": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "enum": [
                            "DUPLICATE_IN_FILE",
                            "OPEN_CHANGE_EXISTS",
                            "SAME_AS_IN_FORCE",
                            "SHARED_WITH_OTHER",
                            "SAME_HAND",
                            "HOLDER_NOT_SUPPLIER"
                          ]
                        },
                        "sentence": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "sentence"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "vendor",
                  "paper",
                  "checkState",
                  "check",
                  "notes"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "lineNumber",
          "cells",
          "edits",
          "values",
          "confidenceBp",
          "problems",
          "hasProblem",
          "lowConfidence",
          "recordId",
          "refusal",
          "groupKey",
          "groupLine",
          "intake"
        ],
        "additionalProperties": false
      },
      "RuleOption1": {
        "type": "object",
        "properties": {
          "when": {
            "type": "object",
            "properties": {
              "amountMinorAtLeast": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "amountMinorBelow": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "amountCurrency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "sourceKinds": {
                "minItems": 1,
                "maxItems": 7,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "MANUAL",
                    "AGENT_PROPOSAL",
                    "RECURRING",
                    "REVERSAL",
                    "IMPORT",
                    "CHAT",
                    "MIGRATION",
                    "PAYMENT_RUN",
                    "INVOICE",
                    "RECEIPT",
                    "BILL",
                    "BILL_SETTLEMENT",
                    "VENDOR_CREDIT"
                  ]
                }
              },
              "accountCode": {
                "type": "string",
                "minLength": 1,
                "maxLength": 32
              },
              "memoContains": {
                "type": "string",
                "minLength": 2,
                "maxLength": 120
              },
              "missingDimension": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "vendorId": {
                "type": "string",
                "minLength": 1
              },
              "newVendor": {
                "type": "boolean",
                "const": true
              },
              "dimensionValueId": {
                "type": "string",
                "minLength": 1
              },
              "billSources": {
                "minItems": 1,
                "maxItems": 4,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "INBOX_DOCUMENT",
                    "MANUAL",
                    "IMPORT",
                    "RECURRING",
                    "CONVERSION"
                  ]
                }
              },
              "vendorPaperNotCurrent": {
                "minItems": 1,
                "maxItems": 8,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "WSIB_CLEARANCE",
                    "INSURANCE_CERTIFICATE",
                    "MASTER_AGREEMENT",
                    "W8BEN",
                    "DIRECT_DEPOSIT_FORM",
                    "WITHHOLDING_WAIVER",
                    "OTHER"
                  ]
                }
              },
              "overBudget": {
                "type": "boolean",
                "const": true
              },
              "orderException": {
                "type": "boolean",
                "const": true
              },
              "customerId": {
                "type": "string",
                "minLength": 1
              },
              "departmentValueId": {
                "type": "string",
                "minLength": 1
              },
              "dueWithinDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 60
              },
              "discountLapsesWithinDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 30
              },
              "vendorIds": {
                "minItems": 1,
                "maxItems": 100,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "exceptVendorIds": {
                "minItems": 1,
                "maxItems": 100,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              }
            },
            "additionalProperties": false
          },
          "then": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "route": {
                    "type": "string",
                    "enum": [
                      "BOOKKEEPER",
                      "SENIOR",
                      "CONTROLLER"
                    ]
                  }
                },
                "required": [
                  "route"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "object",
                    "properties": {
                      "accountCode": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 32
                      },
                      "note": {
                        "type": "string",
                        "maxLength": 200
                      }
                    },
                    "required": [
                      "accountCode"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "autoApprove": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "required": [
                  "autoApprove"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "hold": {
                    "type": "object",
                    "properties": {
                      "maxOpen": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 500
                      }
                    },
                    "required": [
                      "maxOpen"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "hold"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "tolerate": {
                    "type": "object",
                    "properties": {
                      "priceBp": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "quantityBp": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 1000
                      },
                      "capMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "totalCapMinor": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "currency": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      }
                    },
                    "required": [
                      "priceBp",
                      "quantityBp",
                      "capMinor",
                      "totalCapMinor",
                      "currency"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "tolerate"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "fill": {
                    "type": "object",
                    "properties": {
                      "account": {
                        "type": "object",
                        "properties": {
                          "accountCode": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 32
                          }
                        },
                        "required": [
                          "accountCode"
                        ],
                        "additionalProperties": false
                      },
                      "supplyCategory": {
                        "type": "string",
                        "enum": [
                          "GOODS",
                          "SERVICES",
                          "INTANGIBLE_PROPERTY",
                          "REAL_PROPERTY"
                        ]
                      },
                      "itcKind": {
                        "type": "string",
                        "enum": [
                          "GENERAL",
                          "MEALS_ENTERTAINMENT",
                          "PASSENGER_VEHICLE",
                          "ZERO_EMISSION_VEHICLE",
                          "EXEMPT_ACTIVITY",
                          "NONE"
                        ]
                      },
                      "commercialUsePct": {
                        "type": "string",
                        "pattern": "^0(?:\\.\\d{1,4})?$"
                      },
                      "provincialServiceKind": {
                        "type": "string",
                        "enum": [
                          "ACCOUNTING",
                          "ARCHITECTURAL_OR_ENGINEERING",
                          "SECURITY",
                          "NON_RESIDENTIAL_REAL_ESTATE",
                          "ADVERTISING",
                          "ACCOMMODATION"
                        ]
                      },
                      "propertyRegion": {
                        "type": "string",
                        "enum": [
                          "CA-AB",
                          "CA-BC",
                          "CA-MB",
                          "CA-NB",
                          "CA-NL",
                          "CA-NS",
                          "CA-NT",
                          "CA-NU",
                          "CA-ON",
                          "CA-PE",
                          "CA-QC",
                          "CA-SK",
                          "CA-YT"
                        ]
                      },
                      "dimensions": {
                        "minItems": 1,
                        "maxItems": 8,
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/DimensionsItem"
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "fill"
                ],
                "additionalProperties": false
              },
              {
                "$ref": "#/components/schemas/ThenOption7"
              }
            ]
          }
        },
        "required": [
          "when",
          "then"
        ],
        "additionalProperties": false
      },
      "RunwayOption1": {
        "type": "object",
        "properties": {
          "today": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "balanceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "horizonDays": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "crossesZeroOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "lowestMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "lowestOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "endBalanceMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "lastMovementOn": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "days": {
            "maxItems": 91,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "on": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "bills": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "outMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "balanceAfterMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                }
              },
              "required": [
                "on",
                "bills",
                "outMinor",
                "balanceAfterMinor"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "today",
          "balanceMinor",
          "horizonDays",
          "crossesZeroOn",
          "lowestMinor",
          "lowestOn",
          "endBalanceMinor",
          "lastMovementOn",
          "days"
        ],
        "additionalProperties": false
      },
      "ScanOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "financialAccountId": {
            "type": "string"
          },
          "ranAt": {
            "type": "string",
            "minLength": 20
          },
          "ranBy": {
            "type": "string"
          },
          "bankLinesConsidered": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "candidatesConsidered": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "proposalsWritten": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "refusals": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "reason": {
                  "type": "string",
                  "enum": [
                    "ALREADY_MATCHED",
                    "CURRENCY_MISMATCH"
                  ]
                },
                "candidateId": {
                  "type": "string"
                },
                "bankLineId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "detail": {
                  "type": "string"
                }
              },
              "required": [
                "reason",
                "candidateId",
                "bankLineId",
                "detail"
              ],
              "additionalProperties": false
            }
          },
          "truncations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "bankLineId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "candidateId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "eligible": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "considered": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "maxGroupSize": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "bankLineId",
                "candidateId",
                "eligible",
                "considered",
                "maxGroupSize"
              ],
              "additionalProperties": false
            }
          },
          "clearingsConsidered": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "clearingProposals": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "openBillsConsidered": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "openBillProposals": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "financialAccountId",
          "ranAt",
          "ranBy",
          "bankLinesConsidered",
          "candidatesConsidered",
          "proposalsWritten",
          "refusals",
          "truncations",
          "clearingsConsidered",
          "clearingProposals",
          "openBillsConsidered",
          "openBillProposals"
        ],
        "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
      },
      "Senders": {
        "maxItems": 5,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "domain": {
              "type": "string"
            },
            "messageCount": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "lastMessageAt": {
              "type": "string"
            }
          },
          "required": [
            "domain",
            "messageCount",
            "lastMessageAt"
          ],
          "additionalProperties": false
        }
      },
      "Sentence": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "minLength": 8,
            "maxLength": 600
          },
          "source": {
            "type": "string",
            "const": "PERSON"
          },
          "promptVersion": {
            "type": "null"
          }
        },
        "required": [
          "text",
          "source",
          "promptVersion"
        ],
        "additionalProperties": false
      },
      "SetCustomFieldValuesRequest": {
        "type": "object",
        "properties": {
          "customFields": {
            "$ref": "#/components/schemas/CustomFields6"
          }
        },
        "required": [
          "customFields"
        ],
        "additionalProperties": false
      },
      "SkipOption1": {
        "type": "string",
        "enum": [
          "NOT_BILLS_MAILBOX",
          "NO_TEXT",
          "ALREADY_QUERIED",
          "DECIDED_BY_A_PERSON",
          "AUTO_REPLY",
          "NOT_AUTHENTICATED",
          "NOT_A_MESSAGE",
          "VENDOR_ARCHIVED",
          "SENDER_UNKNOWN",
          "SENDER_AMBIGUOUS",
          "REFERENCE_OTHER_SUPPLIER",
          "NOT_A_QUESTION",
          "NO_POLICY",
          "POLICY_EXPIRED",
          "PAUSED_AFTER_THREE_SET_ASIDE",
          "OVER_DAILY_CAP"
        ]
      },
      "SkipReasonOption1": {
        "type": "string",
        "enum": [
          "BILL_HELD",
          "NO_VENDOR",
          "VENDOR_ARCHIVED",
          "VENDOR_HELD",
          "VENDOR_NOT_ACCEPTED",
          "NO_BANKING",
          "BANKING_PENDING",
          "BANKING_RETURNED",
          "BANKING_FOREIGN",
          "IN_RUN",
          "CURRENCY_DIFFERS",
          "PLANNED_LATER",
          "DECLINED_RECENTLY",
          "OPEN_SIGNAL",
          "CREDIT_AVAILABLE",
          "WITHHOLDING_REVIEW",
          "PER_BILL_CAP",
          "MAX_BILLS",
          "WEEK_CAP",
          "NEW_PAYEE",
          "ABOVE_HISTORICAL_MAX",
          "REFUSED_AT_PREPARE"
        ]
      },
      "Source": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "billId": {
                "type": "string"
              },
              "billNumber": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "supplierName": {
                "type": "string"
              },
              "billDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "billLineId": {
                "type": "string"
              },
              "linePosition": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "billId",
              "billNumber",
              "supplierName",
              "billDate",
              "billLineId",
              "linePosition"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Source2": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "document",
              "inbound-email",
              "record",
              "guide"
            ]
          },
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "documentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "documentKind": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Kind7"
              },
              {
                "type": "null"
              }
            ]
          },
          "inboundEmailId": {
            "type": [
              "string",
              "null"
            ]
          },
          "recordType": {
            "type": [
              "string",
              "null"
            ]
          },
          "recordId": {
            "type": [
              "string",
              "null"
            ]
          },
          "guideSlug": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "kind",
          "id",
          "title",
          "documentId",
          "documentKind",
          "inboundEmailId",
          "recordType",
          "recordId",
          "guideSlug"
        ],
        "additionalProperties": false
      },
      "Sources": {
        "maxItems": 5,
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "BILL",
                "SIGNAL",
                "FINDING"
              ]
            },
            "id": {
              "type": "string",
              "minLength": 1
            },
            "label": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "id",
            "label"
          ],
          "additionalProperties": false
        }
      },
      "Span": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "start": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "end": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "start",
              "end"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Standing": {
        "type": "object",
        "properties": {
          "required": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "WSIB_CLEARANCE",
                    "INSURANCE_CERTIFICATE",
                    "MASTER_AGREEMENT",
                    "W8BEN",
                    "DIRECT_DEPOSIT_FORM",
                    "WITHHOLDING_WAIVER",
                    "OTHER"
                  ]
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "CURRENT",
                    "EXPIRING",
                    "LAPSED",
                    "MISSING"
                  ]
                },
                "validUntil": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "documentId": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "kind",
                "state",
                "validUntil",
                "documentId"
              ],
              "additionalProperties": false
            }
          },
          "rollup": {
            "type": "string",
            "enum": [
              "NONE_REQUIRED",
              "CURRENT",
              "EXPIRING",
              "NOT_CURRENT"
            ]
          },
          "requiredSetBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "requiredSetAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "leadDays": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "required",
          "rollup",
          "requiredSetBy",
          "requiredSetAt",
          "leadDays"
        ],
        "additionalProperties": false
      },
      "StartCloseRequest": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string",
            "minLength": 1
          },
          "periodYear": {
            "type": "integer",
            "minimum": 2000,
            "maximum": 2100
          },
          "periodMonth": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12
          }
        },
        "required": [
          "entityId",
          "periodYear",
          "periodMonth"
        ],
        "additionalProperties": false
      },
      "State": {
        "type": "string",
        "enum": [
          "NO_CONTACT_ON_RECORD",
          "NOT_DRAFTED",
          "TO_SEND",
          "NEEDS_SECOND_PERSON",
          "NOT_SENDABLE",
          "ON_ITS_WAY",
          "NOT_SENT_GAVE_UP",
          "SENT",
          "BOUNCED",
          "DISCARDED",
          "REVERSAL_TO_SEND",
          "REVERSAL_SENT"
        ]
      },
      "Statement": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "READING",
                  "IN_REVIEW",
                  "ACCEPTED"
                ]
              }
            },
            "required": [
              "id",
              "status"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Statement2": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "entityTimeZone": {
            "type": "string"
          },
          "vendor": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "displayName": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "displayName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "supplierNamePrinted": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "UPLOAD",
              "MAILED",
              "TYPED"
            ]
          },
          "basis": {
            "type": "string",
            "enum": [
              "OPEN_ITEMS",
              "ACTIVITY"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "READING",
              "IN_REVIEW",
              "ACCEPTED",
              "DISCARDED"
            ]
          },
          "stalled": {
            "type": "boolean"
          },
          "stalledMinutes": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "statementDate": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "periodFrom": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "currency": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "statementNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "figures": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "theirOpening": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "theirClosing": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "ourOpening": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "ourClosing": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "difference": {
                    "type": "string",
                    "pattern": "^-?\\d+$"
                  },
                  "explained": {
                    "type": "object",
                    "properties": {
                      "opening": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      },
                      "rows": {
                        "type": "string",
                        "pattern": "^-?\\d+$"
                      }
                    },
                    "required": [
                      "opening",
                      "rows"
                    ],
                    "additionalProperties": false
                  },
                  "footingGaps": {
                    "type": "object",
                    "properties": {
                      "theirs": {
                        "type": "object",
                        "properties": {
                          "minor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "minor",
                          "sentence"
                        ],
                        "additionalProperties": false
                      },
                      "ours": {
                        "type": "object",
                        "properties": {
                          "minor": {
                            "type": "string",
                            "pattern": "^-?\\d+$"
                          },
                          "sentence": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "minor",
                          "sentence"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "theirs",
                      "ours"
                    ],
                    "additionalProperties": false
                  },
                  "identityHolds": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "required": [
                  "theirOpening",
                  "theirClosing",
                  "ourOpening",
                  "ourClosing",
                  "difference",
                  "explained",
                  "footingGaps",
                  "identityHolds"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "readOutcome": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "OK",
                  "NOT_A_STATEMENT",
                  "UNREADABLE",
                  "DISCLOSURE",
                  "BUDGET",
                  "PROVIDER",
                  "UNPARSABLE",
                  "REFUSED",
                  "FILE_COLUMNS",
                  "TOO_LONG"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "readSentence": {
            "type": [
              "string",
              "null"
            ]
          },
          "readerLocation": {
            "type": [
              "string",
              "null"
            ]
          },
          "promptVersion": {
            "type": [
              "string",
              "null"
            ]
          },
          "linesRead": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "linesKept": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "printedAccountVerdict": {
            "type": [
              "string",
              "null"
            ]
          },
          "supplierNameCheck": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "SAME",
                  "CONFIRMED_BY_PERSON",
                  "NOT_PRINTED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "readAttempts": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "addedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "addedAt": {
            "type": "string",
            "minLength": 20
          },
          "acceptedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "acceptedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "discardedBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "discardedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "discardReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "counts": {
            "$ref": "#/components/schemas/Counts4"
          },
          "notCompared": {
            "type": "object",
            "properties": {
              "otherCurrencyBills": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "currencies": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$"
                }
              }
            },
            "required": [
              "otherCurrencyBills",
              "currencies"
            ],
            "additionalProperties": false
          },
          "readAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "fileHeaders": {
            "maxItems": 60,
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 120
            }
          },
          "document": {
            "$ref": "#/components/schemas/Document"
          },
          "reconciliationDigest": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "entityId",
          "entityName",
          "entityTimeZone",
          "vendor",
          "supplierNamePrinted",
          "source",
          "basis",
          "status",
          "stalled",
          "stalledMinutes",
          "statementDate",
          "periodFrom",
          "currency",
          "statementNumber",
          "figures",
          "readOutcome",
          "readSentence",
          "readerLocation",
          "promptVersion",
          "linesRead",
          "linesKept",
          "printedAccountVerdict",
          "supplierNameCheck",
          "readAttempts",
          "revision",
          "addedBy",
          "addedAt",
          "acceptedBy",
          "acceptedAt",
          "discardedBy",
          "discardedAt",
          "discardReason",
          "counts",
          "notCompared",
          "readAt",
          "fileHeaders",
          "document",
          "reconciliationDigest"
        ],
        "additionalProperties": false
      },
      "StoppedBy": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "by": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "at": {
                "type": "string",
                "minLength": 20
              }
            },
            "required": [
              "by",
              "at"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Stored": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/StoredOption1"
          },
          {
            "type": "null"
          }
        ]
      },
      "StoredOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "$ref": "#/components/schemas/Kind4"
          },
          "state": {
            "type": "string",
            "enum": [
              "OPEN",
              "DISMISSED",
              "CONFIRMED"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "CRITICAL",
              "WARNING",
              "INFO"
            ]
          },
          "sentence": {
            "type": "string"
          },
          "observedAt": {
            "type": "string",
            "minLength": 20
          },
          "decision": {
            "$ref": "#/components/schemas/Decision"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "state",
          "severity",
          "sentence",
          "observedAt",
          "decision",
          "label"
        ],
        "additionalProperties": false
      },
      "StripeFeedsResponse": {
        "type": "object",
        "properties": {
          "connectionId": {
            "type": "string"
          },
          "cutovers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CutoversItem"
            }
          }
        },
        "required": [
          "connectionId",
          "cutovers"
        ],
        "additionalProperties": false
      },
      "Subject": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "BILL",
              "BILL_LINE",
              "VENDOR",
              "BANKING_CHANGE",
              "PAYMENT",
              "INBOUND_EMAIL",
              "DOCUMENT"
            ]
          },
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "id",
          "label"
        ],
        "additionalProperties": false
      },
      "Subject2": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "BILL",
              "PAYMENT",
              "VENDOR_CREDIT",
              "VENDOR"
            ]
          },
          "label": {
            "type": "string"
          },
          "billId": {
            "type": [
              "string",
              "null"
            ]
          },
          "paymentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "vendorCreditId": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "kind",
          "label",
          "billId",
          "paymentId",
          "vendorCreditId"
        ],
        "additionalProperties": false
      },
      "Subject3": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "BILL"
              },
              "billId": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "kind",
              "billId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "PAYMENT"
              },
              "paymentId": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "kind",
              "paymentId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "VENDOR_CREDIT"
              },
              "vendorCreditId": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "kind",
              "vendorCreditId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "VENDOR"
              }
            },
            "required": [
              "kind"
            ],
            "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
      },
      "SuggestFeedAccountResponse": {
        "type": "object",
        "properties": {
          "suggestion": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "glAccountId": {
                    "type": "string"
                  },
                  "glAccountCode": {
                    "type": "string"
                  },
                  "glAccountName": {
                    "type": "string"
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "RULE",
                      "MODEL"
                    ]
                  },
                  "basis": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string"
                  },
                  "compared": {
                    "type": "object",
                    "properties": {
                      "candidates": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "sent": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "candidates",
                      "sent"
                    ],
                    "additionalProperties": false
                  },
                  "decided": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "ACCEPTED",
                          "CHANGED",
                          "DECLINED"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "promptVersion": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "id",
                  "glAccountId",
                  "glAccountCode",
                  "glAccountName",
                  "source",
                  "basis",
                  "reason",
                  "compared",
                  "decided",
                  "promptVersion"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "why": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "NOT_A_BANK_FEED",
                  "NO_ASSET_ACCOUNT",
                  "NO_CONFIDENT_MATCH",
                  "DISCLOSURE",
                  "BUDGET",
                  "REFUSED",
                  "UNPARSABLE",
                  "PROVIDER",
                  "ALREADY_DECIDED"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "suggestion",
          "why"
        ],
        "additionalProperties": false
      },
      "Suggestion": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "weekCapMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              }
            },
            "required": [
              "weekCapMinor"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "perBillCapMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              }
            },
            "required": [
              "perBillCapMinor"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "dueWithinDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 60
              }
            },
            "required": [
              "dueWithinDays"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "discountLapsesWithinDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 30
              }
            },
            "required": [
              "discountLapsesWithinDays"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "excludeVendorIds": {
                "minItems": 1,
                "maxItems": 20,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              }
            },
            "required": [
              "excludeVendorIds"
            ],
            "additionalProperties": false
          }
        ]
      },
      "Survivor": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "legalName": {
            "type": [
              "string",
              "null"
            ]
          },
          "businessNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "taxNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "ARCHIVED"
            ]
          },
          "acceptanceState": {
            "type": "string",
            "enum": [
              "PENDING_ACCEPTANCE",
              "ACCEPTED",
              "REFUSED",
              "NOT_REVIEWED"
            ]
          },
          "paymentHold": {
            "type": "boolean"
          },
          "verifiedAccountLast4": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]{4}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "billCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "openOwed": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "entityId": {
                  "type": "string"
                },
                "currency": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$"
                },
                "openMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                }
              },
              "required": [
                "entityId",
                "currency",
                "openMinor"
              ],
              "additionalProperties": false
            }
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "cameFrom": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "importId": {
                    "type": "string"
                  },
                  "sourceSystem": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "QUICKBOOKS_ONLINE",
                          "QUICKBOOKS_DESKTOP",
                          "XERO",
                          "SAGE_50",
                          "SPREADSHEET",
                          "OTHER"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sourceSystemLabel": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "importedAt": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 20
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "importId",
                  "sourceSystem",
                  "sourceSystemLabel",
                  "importedAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "displayName",
          "legalName",
          "businessNumber",
          "taxNumber",
          "status",
          "acceptanceState",
          "paymentHold",
          "verifiedAccountLast4",
          "billCount",
          "openOwed",
          "createdAt",
          "cameFrom"
        ],
        "additionalProperties": false
      },
      "Survivor2": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "ARCHIVED"
            ]
          }
        },
        "required": [
          "id",
          "displayName",
          "status"
        ],
        "additionalProperties": false
      },
      "Survivor3": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "billCount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "displayName",
          "billCount",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "Sync": {
        "type": "object",
        "properties": {
          "supported": {
            "type": "boolean"
          },
          "unsupportedReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "schedule": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "cron": {
                    "$ref": "#/components/schemas/Cron"
                  },
                  "cadence": {
                    "type": "string",
                    "enum": [
                      "EVERY_HOUR",
                      "EVERY_4_HOURS",
                      "WEEKDAYS",
                      "DAILY",
                      "CUSTOM"
                    ]
                  },
                  "hour": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 23
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "minute": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "timeZone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "words": {
                    "type": "string"
                  },
                  "endsOn": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "target": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string"
                          },
                          "entityName": {
                            "type": "string"
                          },
                          "receivableAccountId": {
                            "type": "string"
                          },
                          "receivableAccountLabel": {
                            "type": "string"
                          },
                          "defaultRegion": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "entityId",
                          "entityName",
                          "receivableAccountId",
                          "receivableAccountLabel",
                          "defaultRegion"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "cron",
                  "cadence",
                  "hour",
                  "minute",
                  "timeZone",
                  "words",
                  "endsOn",
                  "target"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "setBy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "setAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "OFF",
              "CURRENT",
              "BEHIND",
              "RUNNING",
              "FAILING",
              "STOPPED",
              "NEEDS_ATTENTION"
            ]
          },
          "nextReadAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "completeThrough": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "remainingCount": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "failureStreak": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "suspendedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "suspendedReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "timeZone": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        },
        "required": [
          "supported",
          "unsupportedReason",
          "schedule",
          "setBy",
          "setAt",
          "state",
          "nextReadAt",
          "completeThrough",
          "remainingCount",
          "failureStreak",
          "suspendedAt",
          "suspendedReason",
          "timeZone"
        ],
        "additionalProperties": false
      },
      "Target": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string",
            "minLength": 1
          },
          "receivableAccountId": {
            "type": "string",
            "minLength": 1
          },
          "defaultRegion": {
            "type": "string",
            "maxLength": 10
          },
          "defaultAccountId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "since": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          }
        },
        "required": [
          "entityId",
          "receivableAccountId"
        ],
        "additionalProperties": false
      },
      "Target2": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "href": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "type",
              "id",
              "label",
              "href"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Tax": {
        "type": "object",
        "properties": {
          "supplyCategory": {
            "type": "string",
            "enum": [
              "GOODS",
              "SERVICES",
              "INTANGIBLE_PROPERTY",
              "REAL_PROPERTY"
            ]
          },
          "treatmentHint": {
            "type": "string",
            "enum": [
              "STANDARD",
              "ZERO_RATED",
              "EXEMPT",
              "OUT_OF_SCOPE"
            ]
          },
          "itcKind": {
            "default": "GENERAL",
            "type": "string",
            "enum": [
              "GENERAL",
              "MEALS_ENTERTAINMENT",
              "PASSENGER_VEHICLE",
              "ZERO_EMISSION_VEHICLE",
              "EXEMPT_ACTIVITY",
              "NONE"
            ]
          },
          "selfAssessed": {
            "default": false,
            "type": "boolean"
          },
          "provincialServiceKind": {
            "type": "string",
            "enum": [
              "ACCOUNTING",
              "ARCHITECTURAL_OR_ENGINEERING",
              "SECURITY",
              "NON_RESIDENTIAL_REAL_ESTATE",
              "ADVERTISING",
              "ACCOMMODATION"
            ]
          },
          "provincialBase": {
            "type": "string",
            "enum": [
              "IN_BASE",
              "OUTSIDE_BASE"
            ]
          },
          "provincialExemption": {
            "type": "string",
            "enum": [
              "RESALE"
            ]
          },
          "commercialUsePct": {
            "type": "string",
            "pattern": "^(?:0(?:\\.\\d{1,4})?|1(?:\\.0{1,4})?)$"
          },
          "override": {
            "type": "object",
            "properties": {
              "taxCodeId": {
                "type": "string",
                "minLength": 1
              },
              "treatment": {
                "type": "string",
                "enum": [
                  "STANDARD",
                  "ZERO_RATED",
                  "EXEMPT",
                  "OUT_OF_SCOPE"
                ]
              },
              "reason": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              }
            },
            "required": [
              "reason"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "supplyCategory"
        ],
        "additionalProperties": false
      },
      "Tax2": {
        "type": "object",
        "properties": {
          "side": {
            "type": "string",
            "enum": [
              "SALE",
              "PURCHASE"
            ]
          },
          "counterparty": {
            "type": "object",
            "properties": {
              "country": {
                "type": "string",
                "pattern": "^[A-Z]{2}$"
              },
              "region": {
                "type": "string",
                "pattern": "^(CA|US)-[A-Z]{2}$"
              },
              "addresses": {
                "default": [],
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "region": {
                      "type": "string",
                      "pattern": "^(CA|US)-[A-Z]{2}$"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "HOME",
                        "BUSINESS",
                        "OTHER"
                      ]
                    },
                    "mostCloselyConnected": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "region",
                    "kind"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "country"
            ],
            "additionalProperties": false
          },
          "deliveryRegion": {
            "type": "string",
            "pattern": "^(CA|US)-[A-Z]{2}$"
          },
          "deliveryCountry": {
            "type": "string",
            "pattern": "^[A-Z]{2}$"
          },
          "performance": {
            "$ref": "#/components/schemas/Performance"
          },
          "rightsUsableIn": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^(CA|US)-[A-Z]{2}$"
            }
          },
          "rightsUsableShares": {
            "$ref": "#/components/schemas/Performance"
          },
          "propertyRegion": {
            "type": "string",
            "pattern": "^(CA|US)-[A-Z]{2}$"
          },
          "taxPoint": {
            "type": "object",
            "properties": {
              "invoiceDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "invoiceUndelayedDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "agreementDueDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "paymentDate": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "side",
          "counterparty"
        ],
        "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
        }
      },
      "Template": {
        "type": "object",
        "properties": {
          "en": {
            "$ref": "#/components/schemas/Preview"
          },
          "fr": {
            "$ref": "#/components/schemas/Preview"
          }
        },
        "required": [
          "en",
          "fr"
        ],
        "additionalProperties": false
      },
      "TestCopy": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "source": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "current": {
            "$ref": "#/components/schemas/Current2"
          },
          "pending": {
            "$ref": "#/components/schemas/Current2"
          },
          "state": {
            "type": "string",
            "enum": [
              "MAKING",
              "READY",
              "REFRESHING",
              "REFRESH_READY",
              "FAILED",
              "DELETED"
            ]
          },
          "maskContacts": {
            "type": "boolean"
          },
          "deletedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "purgeAfter": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "notCarriedOnSwitch": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "label"
              ],
              "additionalProperties": false
            }
          },
          "may": {
            "type": "object",
            "properties": {
              "refresh": {
                "type": "boolean"
              },
              "switch": {
                "type": "boolean"
              },
              "discard": {
                "type": "boolean"
              },
              "delete": {
                "type": "boolean"
              },
              "promote": {
                "type": "boolean"
              }
            },
            "required": [
              "refresh",
              "switch",
              "discard",
              "delete",
              "promote"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "source",
          "current",
          "pending",
          "state",
          "maskContacts",
          "deletedAt",
          "purgeAfter",
          "notCarriedOnSwitch",
          "may"
        ],
        "additionalProperties": false
      },
      "TheirsOnly": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "reference": {
              "type": "string"
            },
            "date": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "amountMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          "required": [
            "reference",
            "date",
            "amountMinor"
          ],
          "additionalProperties": false
        }
      },
      "ThenOption7": {
        "type": "object",
        "properties": {
          "prepare": {
            "type": "object",
            "properties": {
              "financialAccountId": {
                "type": "string",
                "minLength": 1
              },
              "method": {
                "type": "string",
                "enum": [
                  "EFT",
                  "CHEQUE",
                  "WIRE"
                ]
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "perBillCapMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "weekCapMinor": {
                "type": "string",
                "pattern": "^-?\\d+$"
              },
              "maxBills": {
                "type": "integer",
                "minimum": 1,
                "maximum": 200
              },
              "weekday": {
                "type": "string",
                "enum": [
                  "MON",
                  "TUE",
                  "WED",
                  "THU",
                  "FRI",
                  "SAT",
                  "SUN"
                ]
              },
              "payInDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 14
              }
            },
            "required": [
              "financialAccountId",
              "method",
              "currency",
              "perBillCapMinor",
              "weekCapMinor",
              "maxBills",
              "weekday",
              "payInDays"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "prepare"
        ],
        "additionalProperties": false
      },
      "TieOption1": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string"
          },
          "entityName": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "asOf": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "subledgerMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "controlMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "settlementResidualMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "unexplainedMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "unappliedCreditMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "unnamedLineCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "tied": {
            "type": "boolean"
          },
          "controlAccounts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "balanceMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "BILL",
                    "SETTINGS",
                    "GIFI_FALLBACK"
                  ]
                },
                "subledgerMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "settlementResidualMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                },
                "unexplainedMinor": {
                  "type": "string",
                  "pattern": "^-?\\d+$"
                }
              },
              "required": [
                "id",
                "code",
                "name",
                "balanceMinor",
                "source",
                "subledgerMinor",
                "settlementResidualMinor",
                "unexplainedMinor"
              ],
              "additionalProperties": false
            }
          },
          "exchangeAccountNominated": {
            "type": "boolean"
          }
        },
        "required": [
          "entityId",
          "entityName",
          "currency",
          "asOf",
          "subledgerMinor",
          "controlMinor",
          "settlementResidualMinor",
          "unexplainedMinor",
          "unappliedCreditMinor",
          "unnamedLineCount",
          "tied",
          "controlAccounts",
          "exchangeAccountNominated"
        ],
        "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
      },
      "Totals2": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "entityId": {
              "type": "string"
            },
            "entityName": {
              "type": "string"
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "minor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          "required": [
            "entityId",
            "entityName",
            "currency",
            "minor"
          ],
          "additionalProperties": false
        }
      },
      "Totals3": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "entityId": {
              "type": "string"
            },
            "entityName": {
              "type": "string"
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "openMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          "required": [
            "entityId",
            "entityName",
            "currency",
            "openMinor"
          ],
          "additionalProperties": false
        }
      },
      "Totals4": {
        "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+$"
          },
          "held": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "total": {
            "type": "string",
            "pattern": "^-?\\d+$"
          },
          "dueSoonMinor": {
            "type": "string",
            "pattern": "^-?\\d+$"
          }
        },
        "required": [
          "current",
          "d1to30",
          "d31to60",
          "d61to90",
          "over90",
          "held",
          "total",
          "dueSoonMinor"
        ],
        "additionalProperties": false
      },
      "Type": {
        "type": "string",
        "enum": [
          "vendor.created.v1",
          "vendor.updated.v1",
          "vendor.archived.v1",
          "vendor.restored.v1",
          "vendor.accepted.v1",
          "vendor.bankingVerified.v1",
          "vendor.bankingChangeProposed.v1",
          "vendor.paymentHeld.v1",
          "vendor.paymentHoldReleased.v1",
          "bill.drafted.v1",
          "bill.submitted.v1",
          "bill.approved.v1",
          "bill.declined.v1",
          "bill.voided.v1",
          "bill.held.v1",
          "bill.holdReleased.v1",
          "bill.paymentApplied.v1",
          "bill.paymentReturned.v1",
          "paymentRun.prepared.v1",
          "paymentRun.released.v1",
          "paymentRun.reversed.v1",
          "paymentRun.cancelled.v1",
          "paymentRun.paymentReversed.v1",
          "purchaseOrder.approved.v1",
          "purchaseOrder.sent.v1",
          "purchaseOrder.cancelled.v1",
          "vendorCredit.approved.v1",
          "vendorCredit.applied.v1",
          "job.succeeded.v1",
          "job.failed.v1",
          "job.cancelled.v1"
        ]
      },
      "Under": {
        "anyOf": [
          {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "SETTING"
                  },
                  "by": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  "enabledAt": {
                    "type": "string",
                    "minLength": 20
                  },
                  "expiresAt": {
                    "type": "string",
                    "minLength": 20
                  }
                },
                "required": [
                  "kind",
                  "by",
                  "enabledAt",
                  "expiresAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "PERSON"
                  },
                  "by": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "kind",
                  "by"
                ],
                "additionalProperties": false
              }
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "UndoAgentBatchResponse": {
        "type": "object",
        "properties": {
          "outcome": {
            "type": "string",
            "const": "job_started"
          },
          "job": {
            "$ref": "#/components/schemas/Job"
          },
          "existing": {
            "type": "boolean"
          }
        },
        "required": [
          "outcome",
          "job",
          "existing"
        ],
        "additionalProperties": false
      },
      "ValidFrom": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "iso": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "line": {
                "type": "string",
                "maxLength": 200
              }
            },
            "required": [
              "iso",
              "line"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "Values": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/ValuesItem"
        }
      },
      "ValuesItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "dimensionTypeId": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "parentId": {
            "type": [
              "string",
              "null"
            ]
          },
          "active": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "dimensionTypeId",
          "code",
          "name",
          "parentId",
          "active"
        ],
        "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"
          }
        ]
      },
      "Vendor2": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/Vendor2Option1"
          },
          {
            "type": "null"
          }
        ]
      },
      "Vendor2Option1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "bill",
              "vendor",
              "payment-run",
              "entry",
              "account",
              "entity",
              "person",
              "dimension-value",
              "authority",
              "rule",
              "purchase-order"
            ]
          }
        },
        "required": [
          "id",
          "label",
          "kind"
        ],
        "additionalProperties": false
      },
      "Vendor3": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "legalName": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "displayName",
          "legalName"
        ],
        "additionalProperties": false
      },
      "VendorOption1": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "language": {
            "type": "string",
            "enum": [
              "en",
              "fr"
            ]
          }
        },
        "required": [
          "id",
          "displayName",
          "language"
        ],
        "additionalProperties": false
      },
      "VendorStatement": {
        "default": null,
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "statementDate": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "statementDate"
            ],
            "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
      },
      "ViewsItem2": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "report": {
            "$ref": "#/components/schemas/Report"
          },
          "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
      },
      "ViewsItem3": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "list": {
            "$ref": "#/components/schemas/List"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "filters": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "shared": {
            "type": "boolean"
          },
          "sharedAt": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 20
              },
              {
                "type": "null"
              }
            ]
          },
          "ownerId": {
            "type": "string"
          },
          "ownerName": {
            "type": "string"
          },
          "mine": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "enum": [
              "PERSON",
              "DRAFT"
            ]
          },
          "draftPromptVersion": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "minLength": 20
          },
          "updatedAt": {
            "type": "string",
            "minLength": 20
          }
        },
        "required": [
          "id",
          "list",
          "name",
          "filters",
          "shared",
          "sharedAt",
          "ownerId",
          "ownerName",
          "mine",
          "source",
          "draftPromptVersion",
          "createdAt",
          "updatedAt"
        ],
        "additionalProperties": false
      },
      "Voided": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "by": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ],
                "additionalProperties": false
              },
              "at": {
                "type": "string",
                "minLength": 20
              },
              "reason": {
                "type": "string"
              },
              "entry": {
                "$ref": "#/components/schemas/Entry"
              }
            },
            "required": [
              "by",
              "at",
              "reason",
              "entry"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "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"
          }
        ]
      },
      "WaitingOnYouOption1": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "const": "READ"
              },
              "count": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "oldestOn": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "oldestDays": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "state",
              "count",
              "oldestOn",
              "oldestDays"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "state": {
                "type": "string",
                "const": "UNREAD"
              }
            },
            "required": [
              "state"
            ],
            "additionalProperties": false
          }
        ]
      },
      "WaitingTotals": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "amountMinor": {
              "type": "string",
              "pattern": "^-?\\d+$"
            }
          },
          "required": [
            "currency",
            "amountMinor"
          ],
          "additionalProperties": false
        }
      },
      "Waiver": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "craReference": {
                "type": "string"
              },
              "rateBp": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "validFrom": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "validTo": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              }
            },
            "required": [
              "id",
              "craReference",
              "rateBp",
              "validFrom",
              "validTo"
            ],
            "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
        }
      },
      "Window": {
        "type": "object",
        "properties": {
          "start": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "end": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "label": {
            "type": "string"
          }
        },
        "required": [
          "start",
          "end",
          "label"
        ],
        "additionalProperties": false
      },
      "Window2": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "years": {
                "anyOf": [
                  {
                    "type": "number",
                    "const": 2
                  },
                  {
                    "type": "number",
                    "const": 4
                  }
                ]
              },
              "declared": {
                "type": "boolean"
              },
              "declaredBy": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "fiscalYearEnd": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "firstPeriod": {
                "$ref": "#/components/schemas/Window"
              },
              "lastPeriod": {
                "$ref": "#/components/schemas/Window"
              },
              "lastDay": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "daysLeft": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "postingReturnDue": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "closedForPosting": {
                "type": "boolean"
              }
            },
            "required": [
              "years",
              "declared",
              "declaredBy",
              "fiscalYearEnd",
              "firstPeriod",
              "lastPeriod",
              "lastDay",
              "daysLeft",
              "postingReturnDue",
              "closedForPosting"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "WindowOption1": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "DAYS"
              },
              "days": {
                "type": "integer",
                "minimum": 1,
                "maximum": 28
              }
            },
            "required": [
              "kind",
              "days"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "THROUGH"
              },
              "on": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              }
            },
            "required": [
              "kind",
              "on"
            ],
            "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"
        }
      }
    }
  },
  "x-errors": [
    {
      "family": "validation_failed",
      "code": "validation_failed",
      "status": 422,
      "title": "That request could not be accepted",
      "remedy": "Fix each field named in `fields` and send the request again."
    },
    {
      "family": "unauthenticated",
      "code": "unauthenticated",
      "status": 401,
      "title": "Sign in to continue",
      "remedy": "Send a valid key or access token as a bearer token. If the key was revoked or has expired, ask an administrator of the books to create a new one."
    },
    {
      "family": "permission_denied",
      "code": "permission_denied",
      "status": 403,
      "title": "You do not have permission to do that",
      "remedy": "Use a key or a connection with the access this operation needs, or ask an administrator of the books to change it."
    },
    {
      "family": "not_found",
      "code": "not_found",
      "status": 404,
      "title": "Not found",
      "remedy": "Check the identifier, and that it belongs to the books the key was made for."
    },
    {
      "family": "precondition_failed",
      "code": "precondition_failed",
      "status": 412,
      "title": "The ledger refused that in its current state",
      "remedy": "Read `detail`: it names the state the record is in. Bring the record to the state it asks for, then send the request again."
    },
    {
      "family": "idempotency_conflict",
      "code": "idempotency_conflict",
      "status": 422,
      "title": "That idempotency key was used for a different request",
      "remedy": "Send a new Idempotency-Key for a different request, or send the first request again with its original key."
    },
    {
      "family": "idempotency_in_flight",
      "code": "idempotency_in_flight",
      "status": 409,
      "title": "An identical request is still running",
      "remedy": "Wait for the first request to finish, read the record, and only then decide whether to send it again."
    },
    {
      "family": "conflict",
      "code": "conflict",
      "status": 409,
      "title": "That already exists",
      "remedy": "The record already exists. Read it instead of creating it again."
    },
    {
      "family": "counterparty_link_taken",
      "code": "counterparty_link_taken",
      "status": 409,
      "title": "That supplier reference is already linked to a vendor",
      "remedy": "That supplier reference is linked to another vendor. Use the vendor it is linked to, or unlink it first."
    },
    {
      "family": "payload_too_large",
      "code": "payload_too_large",
      "status": 413,
      "title": "That file is too large",
      "remedy": "Send a smaller body or file. `maxBytes` gives the limit."
    },
    {
      "family": "write_conflict",
      "code": "write_conflict",
      "status": 409,
      "title": "Another change reached that record first",
      "remedy": "Another change reached the record first. Read it again and send your change on top of that."
    },
    {
      "family": "audit_chain_order",
      "code": "audit_chain_order",
      "status": 500,
      "title": "Nothing was saved, and the fault is in Eternify",
      "remedy": "Nothing was saved and the fault is ours. Send the same request again, and quote the X-Request-Id if it keeps failing."
    },
    {
      "family": "unsupported_version",
      "code": "unsupported_version",
      "status": 400,
      "title": "Unsupported API version",
      "remedy": "Send the Eternify-Version header the error names."
    },
    {
      "family": "service_unavailable",
      "code": "service_unavailable",
      "status": 503,
      "title": "The database was busy",
      "remedy": "Nothing was saved. Send the same request again after the number of seconds in Retry-After."
    },
    {
      "family": "not_implemented",
      "code": "not_implemented",
      "status": 501,
      "title": "That is not available yet",
      "remedy": "Retrying will not help. Read `detail` for what would."
    },
    {
      "family": "rate_limited",
      "code": "rate_limited",
      "status": 429,
      "title": "Too many requests",
      "remedy": "Wait the number of seconds in Retry-After, then send the same request again."
    },
    {
      "family": "payment_required",
      "code": "payment_required",
      "status": 402,
      "title": "The provider account has run out of credits",
      "remedy": "An administrator of the books has to top up the provider account. Retrying will not help."
    },
    {
      "family": "bad_gateway",
      "code": "bad_gateway",
      "status": 502,
      "title": "A provider did not answer",
      "remedy": "A provider did not answer. Nothing was saved. Try again later."
    },
    {
      "family": "internal_error",
      "code": "internal_error",
      "status": 500,
      "title": "Something went wrong",
      "remedy": "The fault is ours. Quote the X-Request-Id when you write to us."
    },
    {
      "family": "conflict",
      "code": "api_key_label_taken",
      "status": 409,
      "title": "That already exists",
      "remedy": "Give the key a label no other live key has."
    },
    {
      "family": "conflict",
      "code": "api_key_cap_reached",
      "status": 409,
      "title": "That already exists",
      "remedy": "Revoke a key you no longer use, then make the new one."
    },
    {
      "family": "conflict",
      "code": "api_key_already_revoked",
      "status": 409,
      "title": "That already exists",
      "remedy": "Nothing to do: the key is already revoked."
    },
    {
      "family": "unauthenticated",
      "code": "api_key_revoked",
      "status": 401,
      "title": "Sign in to continue",
      "remedy": "Ask an administrator of the books to create a new key."
    },
    {
      "family": "unauthenticated",
      "code": "api_key_expired",
      "status": 401,
      "title": "Sign in to continue",
      "remedy": "Ask an administrator of the books to create a new key."
    },
    {
      "family": "validation_failed",
      "code": "public_api_field_not_allowed",
      "status": 422,
      "title": "That request could not be accepted",
      "remedy": "Remove the field named in `fields`. It cannot be set through the API."
    },
    {
      "family": "validation_failed",
      "code": "public_api_unknown_field",
      "status": 422,
      "title": "That request could not be accepted",
      "remedy": "Remove the field named in `fields`, or use one this operation's request lists."
    },
    {
      "family": "validation_failed",
      "code": "public_api_unknown_parameter",
      "status": 422,
      "title": "That request could not be accepted",
      "remedy": "Remove the query parameter named in `fields`, or use one this operation lists."
    },
    {
      "family": "payload_too_large",
      "code": "public_api_body_too_large",
      "status": 413,
      "title": "That file is too large",
      "remedy": "Send a body under the limit in `maxBytes`, in smaller requests if needed."
    },
    {
      "family": "not_found",
      "code": "operation_sunset",
      "status": 410,
      "title": "Not found",
      "remedy": "The operation has passed its sunset day. Call the operation that replaces it; the changelog names it."
    },
    {
      "family": "validation_failed",
      "code": "idempotency_key_required",
      "status": 400,
      "title": "That request could not be accepted",
      "remedy": "Send an Idempotency-Key header: a new value for each new request, the same value when you retry it."
    },
    {
      "family": "permission_denied",
      "code": "api_access_not_enabled",
      "status": 403,
      "title": "You do not have permission to do that",
      "remedy": "API access is for Eternify Ledger customers. To turn it on for this workspace, write to info@eternifylabs.com."
    },
    {
      "family": "permission_denied",
      "code": "api_access_ledger_closed",
      "status": 403,
      "title": "You do not have permission to do that",
      "remedy": "These books are archived, so keys no longer reach them. Unarchive the books in the app, or revoke the key."
    },
    {
      "family": "permission_denied",
      "code": "api_key_maker_left",
      "status": 403,
      "title": "You do not have permission to do that",
      "remedy": "The person who made this key is no longer an administrator on these books. An administrator makes a new key."
    }
  ],
  "x-limits": {
    "reads": {
      "quota": 300,
      "windowSeconds": 60,
      "policy": "reads"
    },
    "writes": {
      "quota": 60,
      "windowSeconds": 60,
      "policy": "writes"
    },
    "ledger": {
      "reads": {
        "quota": 3000,
        "windowSeconds": 60,
        "policy": "tenant-reads"
      },
      "writes": {
        "quota": 600,
        "windowSeconds": 60,
        "policy": "tenant-writes"
      }
    },
    "requestBody": {
      "maxBytes": 1048576
    },
    "pagination": {
      "defaultPageSize": 50,
      "maxPageSize": 200,
      "maxCursorLength": 512
    },
    "idempotency": {
      "keptDays": 7
    },
    "webhooks": {
      "attemptTimeoutMs": 10000,
      "eventBodyMaxBytes": 2048
    },
    "apiKeys": {
      "maxLive": 25,
      "defaultDays": 90,
      "maxDays": 366
    }
  }
}
